@evolve.ui/core-components 1.0.0 → 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/Checkbox.d.cts +1 -1
- package/Checkbox.d.mts +1 -1
- package/{DateInput-B8XQZPTx.d.cts → DateInput-CFxTZu3m.d.mts} +2 -2
- package/{DateInput-B8XQZPTx.d.cts.map → DateInput-CFxTZu3m.d.mts.map} +1 -1
- package/{DateInput-CfNmywqQ.d.mts → DateInput-DstMICTl.d.cts} +2 -2
- package/{DateInput-CfNmywqQ.d.mts.map → DateInput-DstMICTl.d.cts.map} +1 -1
- package/{FavoriteButton-CowOPoqo.d.cts → FavoriteButton-BGF-3dze.d.cts} +2 -2
- package/{FavoriteButton-BRY8FVpV.d.mts.map → FavoriteButton-BGF-3dze.d.cts.map} +1 -1
- package/{FavoriteButton-BRY8FVpV.d.mts → FavoriteButton-BZEGWrRo.d.mts} +2 -2
- package/{FavoriteButton-CowOPoqo.d.cts.map → FavoriteButton-BZEGWrRo.d.mts.map} +1 -1
- package/Input.d.cts +1 -1
- package/Input.d.mts +1 -1
- package/Radio.d.cts +1 -1
- package/Radio.d.mts +1 -1
- package/{TextInput-BhkeQZh4.d.cts → TextInput-B7lqQ1gh.d.cts} +3 -3
- package/{TextInput-BhkeQZh4.d.cts.map → TextInput-B7lqQ1gh.d.cts.map} +1 -1
- package/{TextInput-CWCeR18b.d.mts → TextInput-CxoT3np_.d.mts} +3 -3
- package/{TextInput-CWCeR18b.d.mts.map → TextInput-CxoT3np_.d.mts.map} +1 -1
- package/dateInput.d.cts +1 -1
- package/dateInput.d.mts +1 -1
- package/datePicker.d.cts +1 -1
- package/datePicker.d.mts +1 -1
- package/evolve-ui.entries.json +556 -0
- package/favoriteButton.d.cts +1 -1
- package/favoriteButton.d.mts +1 -1
- package/featureFlags/hooks.d.cts +1 -1
- package/featureFlags/hooks.d.mts +1 -1
- 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/{index-BVb-FJDo.d.mts → index-BYPklw8m.d.mts} +2 -2
- package/{index-BVb-FJDo.d.mts.map → index-BYPklw8m.d.mts.map} +1 -1
- package/{index-3V0Y3AU3.d.mts → index-Bvn6svaT.d.cts} +2 -2
- package/{index-3V0Y3AU3.d.mts.map → index-Bvn6svaT.d.cts.map} +1 -1
- package/{index-Bu7c6X7O.d.mts → index-C2zPeUs9.d.mts} +5 -5
- package/{index-Bu7c6X7O.d.mts.map → index-C2zPeUs9.d.mts.map} +1 -1
- package/{index-BXz3rMMk.d.cts → index-Cmz2OD6x.d.cts} +2 -2
- package/{index-BXz3rMMk.d.cts.map → index-Cmz2OD6x.d.cts.map} +1 -1
- package/{index-kchg551L.d.cts → index-DsZAxqnF.d.mts} +2 -2
- package/{index-kchg551L.d.cts.map → index-DsZAxqnF.d.mts.map} +1 -1
- package/{index-BzN9RaXe.d.cts → index-QtMvgJcp.d.cts} +5 -5
- package/{index-BzN9RaXe.d.cts.map → index-QtMvgJcp.d.cts.map} +1 -1
- package/{index-dpfLYhgI.d.mts → index-hrztez-b.d.mts} +2 -2
- package/{index-DBYqF9Sr.d.cts.map → index-hrztez-b.d.mts.map} +1 -1
- package/{index-DBYqF9Sr.d.cts → index-o9dwzLLE.d.cts} +2 -2
- package/{index-dpfLYhgI.d.mts.map → index-o9dwzLLE.d.cts.map} +1 -1
- package/index.d.cts +7 -7
- package/index.d.mts +7 -7
- package/package.json +2 -2
- package/providers.d.cts +1 -1
- package/providers.d.mts +1 -1
- 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
- package/textInput.d.cts +1 -1
- package/textInput.d.mts +1 -1
- package/timePicker.d.cts +1 -1
- package/timePicker.d.mts +1 -1
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
import { Provider, useSetAtom } from 'jotai';
|
|
3
|
+
import { ComponentProps, ReactNode, useCallback, useMemo, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Loading } from '../Loading/Loading';
|
|
6
|
+
import { AdvancedPagination, PaginationProvider } from '../Pagination';
|
|
7
|
+
import { BodySecondary, H3 } from '../Typography/Text/Text';
|
|
8
|
+
import { TableHeader } from './components/TableHeader/TableHeader';
|
|
9
|
+
import { TableControls } from './components/TablePagination/TablePagination';
|
|
10
|
+
import { TableRows } from './components/TableRow/TableRows';
|
|
11
|
+
import { showLeftStickyShadowAtom, TableShadow } from './components/TableShadow/TableShadow';
|
|
12
|
+
import { tableStaticsContext } from './sharedState';
|
|
13
|
+
import { ColumnType, SortType, StaticData, TableBackgroundStyle, TableRowDensity } from './types';
|
|
14
|
+
|
|
15
|
+
type Props<T extends StaticData> = {
|
|
16
|
+
/**
|
|
17
|
+
* Adds a checkbox to the left of each row and in the header.
|
|
18
|
+
* When checked, the row is considered selected.
|
|
19
|
+
*
|
|
20
|
+
* @see `onSelectedRowsChange`
|
|
21
|
+
*/
|
|
22
|
+
actionable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This checkbox goes in the top left of your table.
|
|
25
|
+
*
|
|
26
|
+
* You can use this to "select all" however you'd like.
|
|
27
|
+
*
|
|
28
|
+
* Needs `actionable` to be true to show.
|
|
29
|
+
*/
|
|
30
|
+
actionableCheckbox?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Background color style for the table.
|
|
33
|
+
* Options: 'primary', 'secondary', 'subdued', 'disabled', or 'transparent'.
|
|
34
|
+
*
|
|
35
|
+
* primary - Uses theme.color.background.primary
|
|
36
|
+
* secondary - Uses theme.color.background.secondary
|
|
37
|
+
* subdued - Uses theme.color.background.subdued
|
|
38
|
+
* disabled - Uses theme.color.background.disabled
|
|
39
|
+
* transparent - Uses transparent background
|
|
40
|
+
*
|
|
41
|
+
* @default 'primary'
|
|
42
|
+
*/
|
|
43
|
+
backgroundColor?: TableBackgroundStyle;
|
|
44
|
+
className?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Specification for the columns of the table.
|
|
47
|
+
* Includes how to render each item in the column.
|
|
48
|
+
*/
|
|
49
|
+
columns: ColumnType<T>[];
|
|
50
|
+
/**
|
|
51
|
+
* Whether we're currently sorting by anything, and if so, what.
|
|
52
|
+
*
|
|
53
|
+
* The first item in the tuple is the column key, and the second is the sort direction.
|
|
54
|
+
*
|
|
55
|
+
* @see `onSortChange`
|
|
56
|
+
*/
|
|
57
|
+
currentSort?: undefined | [string, SortType];
|
|
58
|
+
/**
|
|
59
|
+
* The rows of data to be displayed in the table.
|
|
60
|
+
*/
|
|
61
|
+
data: T[];
|
|
62
|
+
/**
|
|
63
|
+
* The default sort direction for columns that are sortable.
|
|
64
|
+
*/
|
|
65
|
+
defaultSortDirection?: SortType;
|
|
66
|
+
/**
|
|
67
|
+
* The text to display when there is no data.
|
|
68
|
+
*/
|
|
69
|
+
emptyStateHeaderText?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The supporting text to display when there is no data.
|
|
72
|
+
*/
|
|
73
|
+
emptyStateSupportingText?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Whether or not to fill the width of the container.
|
|
76
|
+
*
|
|
77
|
+
* Gives equal extra space to each column.
|
|
78
|
+
*/
|
|
79
|
+
fillHorizontal?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether or not to show the border on the main table.
|
|
82
|
+
*/
|
|
83
|
+
hideBorder?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether or not to hide the dividers between rows.
|
|
86
|
+
*/
|
|
87
|
+
hideDividers?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Boolean to use advance pagination component
|
|
90
|
+
*/
|
|
91
|
+
isAdvancedPagination?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether or not to show a loading indicator.
|
|
94
|
+
*/
|
|
95
|
+
loading?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Callback when the selected rows change.
|
|
98
|
+
*
|
|
99
|
+
* @param selectedRows the selected rows in the form of a map of row keys to booleans
|
|
100
|
+
*/
|
|
101
|
+
onSelectedRowsChange?: (selectedRow: T['key']) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback when the sort status of a column changes.
|
|
104
|
+
*
|
|
105
|
+
* @param columnKey The key of the column that was clicked
|
|
106
|
+
* @param newSort The new sort status of the column
|
|
107
|
+
* @see `currentSort`
|
|
108
|
+
*/
|
|
109
|
+
onSortChange?: (columnKey: string, newSort: SortType) => void;
|
|
110
|
+
/**
|
|
111
|
+
* The page size options for the pagination component.
|
|
112
|
+
*/
|
|
113
|
+
pageSizeOptions?: number[];
|
|
114
|
+
/**
|
|
115
|
+
* If provided, the table will add a pagination component.
|
|
116
|
+
*
|
|
117
|
+
* @see `PaginationProvider`
|
|
118
|
+
*/
|
|
119
|
+
pagination?: Omit<ComponentProps<typeof PaginationProvider>, 'path' | 'children'> & {
|
|
120
|
+
/**
|
|
121
|
+
* The key of the pagination provider.
|
|
122
|
+
*
|
|
123
|
+
* This is used to ensure that the pagination provider is only re-rendered when the key changes.
|
|
124
|
+
* @example key={`${currentPage}-${pageSize}-${itemCount}`}
|
|
125
|
+
*/
|
|
126
|
+
key?: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* The height of the rows in the table.
|
|
130
|
+
* - `sm` = 28px
|
|
131
|
+
* - `md` = 36px
|
|
132
|
+
* - `lg` = 48px
|
|
133
|
+
*
|
|
134
|
+
* @default md
|
|
135
|
+
*/
|
|
136
|
+
rowDensity?: TableRowDensity;
|
|
137
|
+
/**
|
|
138
|
+
* The rows that are currently selected.
|
|
139
|
+
*
|
|
140
|
+
* This is a controlled prop.
|
|
141
|
+
*/
|
|
142
|
+
selectedRows?: Set<T['key']>;
|
|
143
|
+
/**
|
|
144
|
+
* Adds vertical dividers between columns in both header and body cells,
|
|
145
|
+
* including the actionable checkbox column. Combine with the default row
|
|
146
|
+
* dividers (`hideDividers={false}`) and outer border (`hideBorder={false}`)
|
|
147
|
+
* for a fully bordered grid.
|
|
148
|
+
*
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
showColumnDividers?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether or not the columns are sortable.
|
|
154
|
+
*
|
|
155
|
+
* @see `onSortChange`
|
|
156
|
+
* @see `currentSort`
|
|
157
|
+
*/
|
|
158
|
+
sortable?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Locks the first column on horizontal scroll.
|
|
161
|
+
*/
|
|
162
|
+
stickyFirstColumn?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Make header sticky when table height is set.
|
|
165
|
+
*
|
|
166
|
+
* @default false
|
|
167
|
+
*
|
|
168
|
+
* .table-container {
|
|
169
|
+
* height: calc(100vh - 200px);
|
|
170
|
+
* }
|
|
171
|
+
*/
|
|
172
|
+
stickyHeader?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Adds a zebra stripe to every other row.
|
|
175
|
+
*/
|
|
176
|
+
zebraStripes?: boolean;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Helper function to get background color classes based on TableBackgroundStyle
|
|
181
|
+
*/
|
|
182
|
+
const getBackgroundColorClasses = (backgroundColor?: TableBackgroundStyle, isZebraStripe = false) => {
|
|
183
|
+
if (!backgroundColor) {
|
|
184
|
+
return 'bg-background-primary';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
switch (backgroundColor) {
|
|
188
|
+
case 'secondary':
|
|
189
|
+
return 'bg-background-secondary';
|
|
190
|
+
case 'subdued':
|
|
191
|
+
return 'bg-background-subdued';
|
|
192
|
+
case 'disabled':
|
|
193
|
+
return 'bg-background-disabled';
|
|
194
|
+
case 'transparent':
|
|
195
|
+
return 'bg-transparent';
|
|
196
|
+
case 'primary':
|
|
197
|
+
if (isZebraStripe) {
|
|
198
|
+
return 'bg-background-subdued';
|
|
199
|
+
}
|
|
200
|
+
return 'bg-background-primary';
|
|
201
|
+
default:
|
|
202
|
+
return 'bg-background-primary';
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const Table = <T extends StaticData>({
|
|
207
|
+
actionable = false,
|
|
208
|
+
backgroundColor,
|
|
209
|
+
hideDividers = false,
|
|
210
|
+
isAdvancedPagination,
|
|
211
|
+
onSelectedRowsChange,
|
|
212
|
+
pageSizeOptions = [25, 50, 100],
|
|
213
|
+
showColumnDividers = false,
|
|
214
|
+
stickyFirstColumn = false,
|
|
215
|
+
stickyHeader = false,
|
|
216
|
+
...props
|
|
217
|
+
}: Props<T>) => {
|
|
218
|
+
const hasNoData = Boolean(props.loading) || !Boolean(props.data.length);
|
|
219
|
+
|
|
220
|
+
// Memoize the context value to prevent unnecessary re-renders
|
|
221
|
+
const contextValue = useMemo(
|
|
222
|
+
() => ({
|
|
223
|
+
actionable,
|
|
224
|
+
backgroundColor,
|
|
225
|
+
hideDividers,
|
|
226
|
+
onSelectedRowsChange,
|
|
227
|
+
pageSizeOptions,
|
|
228
|
+
showColumnDividers,
|
|
229
|
+
stickyFirstColumn: stickyFirstColumn && !hasNoData,
|
|
230
|
+
}),
|
|
231
|
+
[
|
|
232
|
+
actionable,
|
|
233
|
+
backgroundColor,
|
|
234
|
+
hideDividers,
|
|
235
|
+
onSelectedRowsChange,
|
|
236
|
+
pageSizeOptions,
|
|
237
|
+
showColumnDividers,
|
|
238
|
+
stickyFirstColumn,
|
|
239
|
+
hasNoData,
|
|
240
|
+
]
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
// We need a jotai provider to isolate tables from one another.
|
|
244
|
+
return (
|
|
245
|
+
<Provider>
|
|
246
|
+
<tableStaticsContext.Provider value={contextValue}>
|
|
247
|
+
<InnerTable
|
|
248
|
+
backgroundColor={backgroundColor}
|
|
249
|
+
data-hui-id="Table"
|
|
250
|
+
hasNoData={hasNoData}
|
|
251
|
+
hideDividers={hideDividers}
|
|
252
|
+
isAdvancedPagination={isAdvancedPagination}
|
|
253
|
+
stickyFirstColumn={stickyFirstColumn}
|
|
254
|
+
stickyHeader={stickyHeader}
|
|
255
|
+
{...props}
|
|
256
|
+
/>
|
|
257
|
+
</tableStaticsContext.Provider>
|
|
258
|
+
</Provider>
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// react dev tools display name
|
|
263
|
+
Table.displayName = 'Table';
|
|
264
|
+
|
|
265
|
+
const InnerTable = <T extends StaticData>({
|
|
266
|
+
actionableCheckbox,
|
|
267
|
+
backgroundColor,
|
|
268
|
+
className,
|
|
269
|
+
columns,
|
|
270
|
+
currentSort,
|
|
271
|
+
data,
|
|
272
|
+
defaultSortDirection = 'descending',
|
|
273
|
+
emptyStateHeaderText = 'Empty state heading message...',
|
|
274
|
+
emptyStateSupportingText = 'Supporting message to provide further guidance on how to remedy empty state.',
|
|
275
|
+
fillHorizontal = false,
|
|
276
|
+
hasNoData,
|
|
277
|
+
hideBorder = false,
|
|
278
|
+
hideDividers = false,
|
|
279
|
+
isAdvancedPagination,
|
|
280
|
+
loading = false,
|
|
281
|
+
onSortChange,
|
|
282
|
+
pagination,
|
|
283
|
+
rowDensity = 'md',
|
|
284
|
+
selectedRows,
|
|
285
|
+
sortable = false,
|
|
286
|
+
stickyFirstColumn = false,
|
|
287
|
+
stickyHeader = false,
|
|
288
|
+
zebraStripes = false,
|
|
289
|
+
}: Props<T> & {
|
|
290
|
+
hasNoData: boolean;
|
|
291
|
+
}) => {
|
|
292
|
+
const [showRightScrollHint, setShowRightScrollHint] = useState(false);
|
|
293
|
+
const [showLeftScrollHint, setShowLeftScrollHint] = useState(false);
|
|
294
|
+
const [showTopScrollHint, setShowTopScrollHint] = useState(false);
|
|
295
|
+
const setShowLeftShadow = useSetAtom(showLeftStickyShadowAtom);
|
|
296
|
+
|
|
297
|
+
const handleScroll = useCallback(
|
|
298
|
+
(ref: HTMLDivElement) => {
|
|
299
|
+
setShowLeftShadow(stickyFirstColumn && ref.scrollLeft > 20);
|
|
300
|
+
setShowLeftScrollHint(!stickyFirstColumn && ref.scrollLeft > 50);
|
|
301
|
+
setShowRightScrollHint(ref.scrollLeft + ref.clientWidth < ref.scrollWidth - 50);
|
|
302
|
+
setShowTopScrollHint(ref.scrollTop !== 0);
|
|
303
|
+
},
|
|
304
|
+
[setShowLeftShadow, stickyFirstColumn]
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
let rowHeight = 0;
|
|
308
|
+
switch (rowDensity) {
|
|
309
|
+
case 'sm':
|
|
310
|
+
rowHeight = 28;
|
|
311
|
+
break;
|
|
312
|
+
case 'md':
|
|
313
|
+
rowHeight = 36;
|
|
314
|
+
break;
|
|
315
|
+
case 'lg':
|
|
316
|
+
rowHeight = 48;
|
|
317
|
+
break;
|
|
318
|
+
default:
|
|
319
|
+
rowHeight = 36;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Container classes
|
|
324
|
+
const containerClasses = cn(
|
|
325
|
+
'relative max-w-full',
|
|
326
|
+
{
|
|
327
|
+
'w-full': fillHorizontal,
|
|
328
|
+
'w-min': !fillHorizontal,
|
|
329
|
+
},
|
|
330
|
+
className,
|
|
331
|
+
'table-container'
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
// RelativeContainer classes
|
|
335
|
+
const relativeContainerClasses = cn(
|
|
336
|
+
'relative',
|
|
337
|
+
{
|
|
338
|
+
'border border-border-secondary': !hideBorder,
|
|
339
|
+
'border-b-0': !hideDividers && !hasNoData && !hideBorder,
|
|
340
|
+
'h-auto': !stickyHeader,
|
|
341
|
+
'h-full': stickyHeader,
|
|
342
|
+
'w-full': fillHorizontal,
|
|
343
|
+
},
|
|
344
|
+
getBackgroundColorClasses(backgroundColor)
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
// TableScroll classes
|
|
348
|
+
const tableScrollClasses = cn(
|
|
349
|
+
'w-full',
|
|
350
|
+
{
|
|
351
|
+
'h-auto': !stickyHeader,
|
|
352
|
+
'h-full': stickyHeader,
|
|
353
|
+
'min-h-[220px]': loading || data.length === 0,
|
|
354
|
+
'overflow-x-auto': !hasNoData,
|
|
355
|
+
'overflow-x-hidden': hasNoData,
|
|
356
|
+
'overflow-y-auto': stickyHeader,
|
|
357
|
+
'overflow-y-visible': !stickyHeader,
|
|
358
|
+
},
|
|
359
|
+
getBackgroundColorClasses(backgroundColor)
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
// Table classes
|
|
363
|
+
const tableClasses = cn(
|
|
364
|
+
'border-collapse',
|
|
365
|
+
{
|
|
366
|
+
'w-full': fillHorizontal,
|
|
367
|
+
},
|
|
368
|
+
getBackgroundColorClasses(backgroundColor),
|
|
369
|
+
// Row height styles using CSS custom properties for dynamic values
|
|
370
|
+
'[&_td]:h-[var(--row-height)] [&_th]:h-[var(--row-height)]',
|
|
371
|
+
// Background color for th and td elements
|
|
372
|
+
{
|
|
373
|
+
'[&_th]:bg-background-disabled': backgroundColor === 'disabled',
|
|
374
|
+
'[&_th]:bg-background-primary': backgroundColor === 'primary' || !backgroundColor,
|
|
375
|
+
'[&_th]:bg-background-secondary': backgroundColor === 'secondary',
|
|
376
|
+
'[&_th]:bg-background-subdued': backgroundColor === 'subdued',
|
|
377
|
+
'[&_th]:bg-transparent': backgroundColor === 'transparent',
|
|
378
|
+
},
|
|
379
|
+
// Scroll hint shadows using pseudo-elements
|
|
380
|
+
'[&::before]:pointer-events-none [&::before]:absolute [&::before]:z-[1] [&::before]:content-[""]',
|
|
381
|
+
'[&::before]:bottom-0 [&::before]:left-0 [&::before]:top-0 [&::before]:w-[48px]',
|
|
382
|
+
'[&::before]:opacity-0 [&::before]:transition-opacity [&::before]:duration-200',
|
|
383
|
+
'[&::before]:shadow-[8px_0px_8px_0px_rgba(0,0,0,0.1)_inset]',
|
|
384
|
+
{
|
|
385
|
+
'[&::before]:opacity-100': showLeftScrollHint && !hasNoData,
|
|
386
|
+
},
|
|
387
|
+
'[&::after]:pointer-events-none [&::after]:absolute [&::after]:z-[1] [&::after]:content-[""]',
|
|
388
|
+
'[&::after]:bottom-0 [&::after]:right-0 [&::after]:top-0 [&::after]:w-[48px]',
|
|
389
|
+
'[&::after]:opacity-0 [&::after]:transition-opacity [&::after]:duration-200',
|
|
390
|
+
'[&::after]:shadow-[-8px_0px_8px_0px_rgba(0,0,0,0.1)_inset]',
|
|
391
|
+
{
|
|
392
|
+
'[&::after]:opacity-100': showRightScrollHint && !hasNoData,
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
// Empty state container classes
|
|
397
|
+
const emptyStateContainerClasses = cn(
|
|
398
|
+
'absolute flex w-full flex-col items-center justify-center py-2xl text-center'
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<div
|
|
403
|
+
className={containerClasses}
|
|
404
|
+
style={{ '--row-height': `${rowHeight}px` } as React.CSSProperties}
|
|
405
|
+
>
|
|
406
|
+
<div className={relativeContainerClasses}>
|
|
407
|
+
<div
|
|
408
|
+
className={tableScrollClasses}
|
|
409
|
+
ref={(ref: HTMLDivElement | null) => {
|
|
410
|
+
if (!ref) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Add a scroll event listener to the table scroll container
|
|
415
|
+
// to determine if the right scroll hint should be shown
|
|
416
|
+
ref.addEventListener('scroll', () => {
|
|
417
|
+
handleScroll(ref);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
handleScroll(ref);
|
|
421
|
+
}}
|
|
422
|
+
>
|
|
423
|
+
<table className={tableClasses}>
|
|
424
|
+
<TableHeader
|
|
425
|
+
actionableCheckbox={actionableCheckbox}
|
|
426
|
+
backgroundColor={backgroundColor}
|
|
427
|
+
columns={columns}
|
|
428
|
+
currentSort={currentSort}
|
|
429
|
+
data={data}
|
|
430
|
+
defaultSortDirection={defaultSortDirection}
|
|
431
|
+
onSortChange={onSortChange}
|
|
432
|
+
showTopScrollHint={showTopScrollHint}
|
|
433
|
+
sortable={sortable}
|
|
434
|
+
stickyHeader={stickyHeader}
|
|
435
|
+
/>
|
|
436
|
+
|
|
437
|
+
{!loading && Boolean(data.length) && (
|
|
438
|
+
<TableRows
|
|
439
|
+
backgroundColor={backgroundColor}
|
|
440
|
+
columns={columns}
|
|
441
|
+
data={data}
|
|
442
|
+
selectedRows={selectedRows}
|
|
443
|
+
zebraStripes={zebraStripes}
|
|
444
|
+
/>
|
|
445
|
+
)}
|
|
446
|
+
</table>
|
|
447
|
+
{!hasNoData && <TableShadow />}
|
|
448
|
+
|
|
449
|
+
{!loading && !Boolean(data.length) && (
|
|
450
|
+
<div className={emptyStateContainerClasses}>
|
|
451
|
+
<H3>{emptyStateHeaderText}</H3>
|
|
452
|
+
<BodySecondary>{emptyStateSupportingText}</BodySecondary>
|
|
453
|
+
</div>
|
|
454
|
+
)}
|
|
455
|
+
|
|
456
|
+
{loading && (
|
|
457
|
+
<div className={emptyStateContainerClasses}>
|
|
458
|
+
<Loading size={32} />
|
|
459
|
+
</div>
|
|
460
|
+
)}
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
{pagination && !hasNoData && (
|
|
464
|
+
<PaginationProvider
|
|
465
|
+
{...pagination}
|
|
466
|
+
key={pagination.key}
|
|
467
|
+
path=""
|
|
468
|
+
>
|
|
469
|
+
{isAdvancedPagination ? <AdvancedPagination className="px-0 py-sm" /> : <TableControls />}
|
|
470
|
+
</PaginationProvider>
|
|
471
|
+
)}
|
|
472
|
+
</div>
|
|
473
|
+
);
|
|
474
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
import { useSetAtom } from 'jotai';
|
|
3
|
+
import { ReactNode, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
import { ArrowUp } from '../../../Icons';
|
|
6
|
+
import { tableStaticsContext } from '../../sharedState';
|
|
7
|
+
import { ColumnType, SortType, StaticData, TableBackgroundStyle } from '../../types';
|
|
8
|
+
import { leftStickyShadowWidthAtom, observeFirstColumnWidth } from '../TableShadow/TableShadow';
|
|
9
|
+
|
|
10
|
+
interface Props<T extends StaticData> {
|
|
11
|
+
actionableCheckbox: ReactNode;
|
|
12
|
+
backgroundColor?: TableBackgroundStyle;
|
|
13
|
+
columns: ColumnType<T>[];
|
|
14
|
+
currentSort?: [string, SortType];
|
|
15
|
+
data: T[];
|
|
16
|
+
defaultSortDirection: SortType;
|
|
17
|
+
onSortChange?: (columnKey: string, newSort: SortType) => void;
|
|
18
|
+
showTopScrollHint: boolean;
|
|
19
|
+
sortable: boolean;
|
|
20
|
+
stickyHeader: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function TableHeader<T extends StaticData>({
|
|
24
|
+
actionableCheckbox,
|
|
25
|
+
backgroundColor,
|
|
26
|
+
columns,
|
|
27
|
+
currentSort,
|
|
28
|
+
defaultSortDirection,
|
|
29
|
+
onSortChange,
|
|
30
|
+
showTopScrollHint,
|
|
31
|
+
sortable,
|
|
32
|
+
stickyHeader,
|
|
33
|
+
}: Props<T>) {
|
|
34
|
+
const { actionable, showColumnDividers, stickyFirstColumn } = useContext(tableStaticsContext);
|
|
35
|
+
const setLeftShadowWidth = useSetAtom(leftStickyShadowWidthAtom);
|
|
36
|
+
|
|
37
|
+
const tableBackgroundColor: TableBackgroundStyle =
|
|
38
|
+
backgroundColor === 'transparent' && stickyHeader ? 'primary' : 'transparent';
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<thead>
|
|
42
|
+
<tr
|
|
43
|
+
className={cn('relative border-b border-border-primary', {
|
|
44
|
+
// BACKGROUND COLOR
|
|
45
|
+
'bg-background-primary': tableBackgroundColor === 'primary',
|
|
46
|
+
'bg-transparent': tableBackgroundColor === 'transparent',
|
|
47
|
+
'shadow-01': stickyHeader && showTopScrollHint,
|
|
48
|
+
// STICKY HEADER
|
|
49
|
+
'sticky top-0 z-[5]': stickyHeader,
|
|
50
|
+
})}
|
|
51
|
+
style={{
|
|
52
|
+
transition: stickyHeader ? '0.25s' : undefined,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{actionable && (
|
|
56
|
+
<th
|
|
57
|
+
className={cn(
|
|
58
|
+
'hui-text-label-strong bg-background-primary p-0 transition-colors duration-200',
|
|
59
|
+
{
|
|
60
|
+
'bg-background-primary': tableBackgroundColor === 'primary',
|
|
61
|
+
'bg-transparent': tableBackgroundColor === 'transparent',
|
|
62
|
+
// COLUMN DIVIDER
|
|
63
|
+
'border-r border-border-secondary last:border-r-0': showColumnDividers,
|
|
64
|
+
}
|
|
65
|
+
)}
|
|
66
|
+
key="actionable"
|
|
67
|
+
scope="col"
|
|
68
|
+
style={
|
|
69
|
+
stickyFirstColumn
|
|
70
|
+
? {
|
|
71
|
+
left: 0,
|
|
72
|
+
paddingLeft: '14px',
|
|
73
|
+
position: 'sticky',
|
|
74
|
+
zIndex: 1,
|
|
75
|
+
}
|
|
76
|
+
: {}
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
{actionableCheckbox}
|
|
80
|
+
</th>
|
|
81
|
+
)}
|
|
82
|
+
{columns.map((column, i) => {
|
|
83
|
+
const newDirection =
|
|
84
|
+
currentSort && currentSort[0] === column.key
|
|
85
|
+
? currentSort[1] === 'ascending'
|
|
86
|
+
? 'descending'
|
|
87
|
+
: 'ascending'
|
|
88
|
+
: defaultSortDirection;
|
|
89
|
+
|
|
90
|
+
let ariaSort: undefined | 'none' | 'ascending' | 'descending' = undefined;
|
|
91
|
+
|
|
92
|
+
if (currentSort && currentSort[0] === column.key) {
|
|
93
|
+
ariaSort = currentSort[1];
|
|
94
|
+
} else if (column.sortable) {
|
|
95
|
+
ariaSort = 'none';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const isFirstColumn = i === 0;
|
|
99
|
+
const isStickyFirstColumn = stickyFirstColumn && isFirstColumn;
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<th
|
|
103
|
+
aria-sort={ariaSort}
|
|
104
|
+
className={cn('hui-text-label-strong relative p-0 transition-colors duration-200', {
|
|
105
|
+
'active:bg-background-pressed': sortable && column.sortable,
|
|
106
|
+
// BACKGROUND COLOR
|
|
107
|
+
'bg-background-primary': tableBackgroundColor === 'primary',
|
|
108
|
+
'bg-transparent': tableBackgroundColor === 'transparent',
|
|
109
|
+
// COLUMN DIVIDER
|
|
110
|
+
'border-r border-border-secondary last:border-r-0': showColumnDividers,
|
|
111
|
+
// SORTABLE STATES
|
|
112
|
+
'group cursor-pointer': sortable && column.sortable,
|
|
113
|
+
'hover:bg-background-hover': sortable && column.sortable,
|
|
114
|
+
// STICKY FIRST COLUMN
|
|
115
|
+
'sticky z-[1] shadow-02': isStickyFirstColumn,
|
|
116
|
+
})}
|
|
117
|
+
// Using the index as the key is fine here because the columns won't change.
|
|
118
|
+
key={i}
|
|
119
|
+
onClick={
|
|
120
|
+
sortable && column.sortable && onSortChange
|
|
121
|
+
? () => onSortChange(column.key as string, newDirection)
|
|
122
|
+
: undefined
|
|
123
|
+
}
|
|
124
|
+
ref={i === 0 ? observeFirstColumnWidth(setLeftShadowWidth) : undefined}
|
|
125
|
+
scope="col"
|
|
126
|
+
style={
|
|
127
|
+
isStickyFirstColumn
|
|
128
|
+
? {
|
|
129
|
+
left: actionable ? '48px' : '0',
|
|
130
|
+
transform: 'translateX(-1px)',
|
|
131
|
+
}
|
|
132
|
+
: {}
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
<span
|
|
136
|
+
className={cn('flex items-center gap-xs whitespace-nowrap px-sm', {
|
|
137
|
+
'justify-end': column.align === 'right',
|
|
138
|
+
'justify-start': column.align !== 'right',
|
|
139
|
+
})}
|
|
140
|
+
>
|
|
141
|
+
{column.header ?? null}
|
|
142
|
+
{sortable && column.sortable && (
|
|
143
|
+
<ArrowUp
|
|
144
|
+
className={cn('transition-all duration-200', {
|
|
145
|
+
'group-hover:rotate-0': ariaSort === 'descending',
|
|
146
|
+
'group-hover:rotate-180': ariaSort === 'ascending',
|
|
147
|
+
// HOVER STATE - Show on hover for unsorted columns
|
|
148
|
+
'group-hover:visible group-hover:opacity-100': ariaSort === 'none',
|
|
149
|
+
// DEFAULT STATE - Hidden for unsorted columns
|
|
150
|
+
'invisible opacity-0': ariaSort === 'none',
|
|
151
|
+
// ASCENDING STATE - Always visible, rotate on hover
|
|
152
|
+
'visible opacity-100': ariaSort === 'ascending',
|
|
153
|
+
// DESCENDING STATE - Always visible and rotated, rotate back on hover
|
|
154
|
+
'visible rotate-180 opacity-100': ariaSort === 'descending',
|
|
155
|
+
})}
|
|
156
|
+
size="sm"
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
</span>
|
|
160
|
+
</th>
|
|
161
|
+
);
|
|
162
|
+
})}
|
|
163
|
+
</tr>
|
|
164
|
+
</thead>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ItemCountDisplay } from './components/ItemCountDisplay/ItemCountDisplay';
|
|
2
|
+
import { ItemCountSelect } from './components/ItemCountSelect/ItemCountSelect';
|
|
3
|
+
import { Pagination } from './components/TablePaginator/TablePaginator';
|
|
4
|
+
|
|
5
|
+
export const TableControls = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
className="flex items-center justify-between pt-4"
|
|
9
|
+
data-hui-id="TableControls"
|
|
10
|
+
>
|
|
11
|
+
<ItemCountSelect />
|
|
12
|
+
<ItemCountDisplay />
|
|
13
|
+
<Pagination />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
TableControls.displayName = 'TableControls';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { usePagination } from '../../../../../Pagination';
|
|
2
|
+
import { BodyPrimary } from '../../../../../Typography/Text/Text';
|
|
3
|
+
|
|
4
|
+
export const ItemCountDisplay = () => {
|
|
5
|
+
const { itemCount, page, pageSize } = usePagination();
|
|
6
|
+
|
|
7
|
+
if (pageSize === 'all') {
|
|
8
|
+
return <BodyPrimary>{itemCount} Items</BodyPrimary>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<BodyPrimary>{`${(page - 1) * pageSize + 1} - ${Math.min(
|
|
13
|
+
page * pageSize,
|
|
14
|
+
itemCount
|
|
15
|
+
)} of ${itemCount} Items`}</BodyPrimary>
|
|
16
|
+
);
|
|
17
|
+
};
|