@cleen/ui 0.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/package.json +54 -0
- package/src/charts/chart/Chart.tsx +82 -0
- package/src/charts/chart/constant.ts +50 -0
- package/src/charts/chart/index.ts +2 -0
- package/src/charts/chart/types/apexcharts.ts +9 -0
- package/src/charts/chart/variants/BellCurve/BellCurve.tsx +215 -0
- package/src/charts/chart/variants/BellCurve/constant.ts +112 -0
- package/src/charts/chart/variants/BellCurve/helper.ts +116 -0
- package/src/charts/chart/variants/BellCurve/index.ts +2 -0
- package/src/charts/chart/variants/BellCurve/types/bellCurve.ts +47 -0
- package/src/charts/chart/variants/BellCurve/types/props.ts +21 -0
- package/src/charts/chart/variants/RadarChart/RadarChart.tsx +22 -0
- package/src/charts/chart/variants/RadarChart/constant.ts +28 -0
- package/src/charts/chart/variants/RadarChart/index.ts +1 -0
- package/src/charts/chart/variants/ScatterChart/ScatterChart.tsx +23 -0
- package/src/charts/chart/variants/ScatterChart/constant.ts +54 -0
- package/src/charts/chart/variants/ScatterChart/index.ts +1 -0
- package/src/charts/chart/variants/index.ts +3 -0
- package/src/charts/index.ts +2 -0
- package/src/charts/simpleChart/SimpleChart.tsx +54 -0
- package/src/charts/simpleChart/index.ts +1 -0
- package/src/components/advancedProgressBar/AdvancedProgressBar.tsx +156 -0
- package/src/components/advancedProgressBar/blocks/Bar.tsx +118 -0
- package/src/components/advancedProgressBar/blocks/BlockLabel.tsx +49 -0
- package/src/components/advancedProgressBar/blocks/Clamp.tsx +85 -0
- package/src/components/advancedProgressBar/constants.ts +6 -0
- package/src/components/advancedProgressBar/index.ts +2 -0
- package/src/components/advancedProgressBar/types/props.ts +69 -0
- package/src/components/advancedProgressBar/utils.ts +17 -0
- package/src/components/audioPlayback/AudioPlayback.tsx +141 -0
- package/src/components/audioPlayback/index.ts +2 -0
- package/src/components/audioRecorder/AudioRecorder.tsx +391 -0
- package/src/components/audioRecorder/constant/default.ts +19 -0
- package/src/components/audioRecorder/constant/labels.ts +9 -0
- package/src/components/audioRecorder/index.ts +2 -0
- package/src/components/audioRecorder/types/props.ts +56 -0
- package/src/components/avatar/Avatar.tsx +132 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/avatar/variants.ts +9 -0
- package/src/components/avatarRow/AvatarRow.tsx +127 -0
- package/src/components/avatarRow/index.ts +1 -0
- package/src/components/breadcrumb/Breadcrumb.tsx +158 -0
- package/src/components/breadcrumb/index.ts +1 -0
- package/src/components/button/Button.tsx +114 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button/variants.ts +41 -0
- package/src/components/card/Card.tsx +197 -0
- package/src/components/card/index.ts +3 -0
- package/src/components/card/variants/CardIcon/CardIcon.tsx +158 -0
- package/src/components/card/variants/CardMedia/CardMedia.tsx +127 -0
- package/src/components/checkbox/Checkbox.tsx +246 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/checkbox/variants.ts +13 -0
- package/src/components/checkboxGroup/CheckboxGroup.tsx +163 -0
- package/src/components/checkboxGroup/index.ts +1 -0
- package/src/components/cleenIcon/CleenIcon.tsx +674 -0
- package/src/components/cleenIcon/icons/IconAlertCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconAlertFeatured.tsx +30 -0
- package/src/components/cleenIcon/icons/IconAlertOctagon.tsx +21 -0
- package/src/components/cleenIcon/icons/IconAlertTriangle.tsx +25 -0
- package/src/components/cleenIcon/icons/IconAlignRight.tsx +25 -0
- package/src/components/cleenIcon/icons/IconArrowDown.tsx +25 -0
- package/src/components/cleenIcon/icons/IconArrowLeft.tsx +25 -0
- package/src/components/cleenIcon/icons/IconArrowLeft2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconArrowRight.tsx +25 -0
- package/src/components/cleenIcon/icons/IconArrowToTop.tsx +20 -0
- package/src/components/cleenIcon/icons/IconArrowUp.tsx +22 -0
- package/src/components/cleenIcon/icons/IconArrowUpRight.tsx +22 -0
- package/src/components/cleenIcon/icons/IconArrowUpRightNarrow.tsx +22 -0
- package/src/components/cleenIcon/icons/IconArrowUpRightSquare.tsx +22 -0
- package/src/components/cleenIcon/icons/IconAttachment.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBarChartSquare.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBold.tsx +16 -0
- package/src/components/cleenIcon/icons/IconBookmarkCheck.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBookmarkCheckFill.tsx +37 -0
- package/src/components/cleenIcon/icons/IconBookmarkPlus.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBookmarkX.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBoxLines.tsx +16 -0
- package/src/components/cleenIcon/icons/IconBoxText.tsx +24 -0
- package/src/components/cleenIcon/icons/IconBracketsCheck.tsx +25 -0
- package/src/components/cleenIcon/icons/IconBracketsEllipses.tsx +22 -0
- package/src/components/cleenIcon/icons/IconBuilding.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCalendar.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCertificateHeart.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCheck.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCheckCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCheckCircleBroken.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCheckFill.tsx +45 -0
- package/src/components/cleenIcon/icons/IconCheckVerified.tsx +22 -0
- package/src/components/cleenIcon/icons/IconChevronDown.tsx +22 -0
- package/src/components/cleenIcon/icons/IconChevronLeft.tsx +25 -0
- package/src/components/cleenIcon/icons/IconChevronLeftDouble.tsx +22 -0
- package/src/components/cleenIcon/icons/IconChevronRight.tsx +25 -0
- package/src/components/cleenIcon/icons/IconChevronRightDouble.tsx +22 -0
- package/src/components/cleenIcon/icons/IconChevronSelectorVertical.tsx +22 -0
- package/src/components/cleenIcon/icons/IconChevronUp.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCircleSwap.tsx +22 -0
- package/src/components/cleenIcon/icons/IconClockFastForward.tsx +25 -0
- package/src/components/cleenIcon/icons/IconClockRewind.tsx +25 -0
- package/src/components/cleenIcon/icons/IconClockRewind2.tsx +21 -0
- package/src/components/cleenIcon/icons/IconCodeBrowser.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCodeCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconColors.tsx +25 -0
- package/src/components/cleenIcon/icons/IconColumnEdit.tsx +19 -0
- package/src/components/cleenIcon/icons/IconCopy.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCopy2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCopy3.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCopy4.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCopy5.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCopyCheck.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCube.tsx +25 -0
- package/src/components/cleenIcon/icons/IconCubeOutline.tsx +22 -0
- package/src/components/cleenIcon/icons/IconCursorBox.tsx +25 -0
- package/src/components/cleenIcon/icons/IconDataflow.tsx +22 -0
- package/src/components/cleenIcon/icons/IconDataflow2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconDataflow3.tsx +29 -0
- package/src/components/cleenIcon/icons/IconDelete.tsx +25 -0
- package/src/components/cleenIcon/icons/IconDollarCircle.tsx +25 -0
- package/src/components/cleenIcon/icons/IconDotsGrid.tsx +74 -0
- package/src/components/cleenIcon/icons/IconDotsHorizontal.tsx +34 -0
- package/src/components/cleenIcon/icons/IconDotsVertical.tsx +38 -0
- package/src/components/cleenIcon/icons/IconEdit.tsx +25 -0
- package/src/components/cleenIcon/icons/IconEditable.tsx +25 -0
- package/src/components/cleenIcon/icons/IconExpand.tsx +22 -0
- package/src/components/cleenIcon/icons/IconEye.tsx +28 -0
- package/src/components/cleenIcon/icons/IconEyeHidden.tsx +25 -0
- package/src/components/cleenIcon/icons/IconEyeHidden2.tsx +24 -0
- package/src/components/cleenIcon/icons/IconFaceSmile.tsx +24 -0
- package/src/components/cleenIcon/icons/IconFilter.tsx +22 -0
- package/src/components/cleenIcon/icons/IconFilter2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconFlag.tsx +22 -0
- package/src/components/cleenIcon/icons/IconFlag2.tsx +25 -0
- package/src/components/cleenIcon/icons/IconFlag3.tsx +16 -0
- package/src/components/cleenIcon/icons/IconHandShield.tsx +22 -0
- package/src/components/cleenIcon/icons/IconHash.tsx +22 -0
- package/src/components/cleenIcon/icons/IconHeadsetMic.tsx +21 -0
- package/src/components/cleenIcon/icons/IconHeart.tsx +24 -0
- package/src/components/cleenIcon/icons/IconHouseLine.tsx +22 -0
- package/src/components/cleenIcon/icons/IconImage.tsx +22 -0
- package/src/components/cleenIcon/icons/IconImage2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconImage3.tsx +17 -0
- package/src/components/cleenIcon/icons/IconImage4.tsx +25 -0
- package/src/components/cleenIcon/icons/IconImageCheck.tsx +22 -0
- package/src/components/cleenIcon/icons/IconInfoCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconInfoHexagon.tsx +25 -0
- package/src/components/cleenIcon/icons/IconItalic.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLayersMultiple.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLayersSingle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLayout.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLayout2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLayoutColumns.tsx +20 -0
- package/src/components/cleenIcon/icons/IconLayoutCustom.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLayoutSequential.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLayoutStuffed.tsx +20 -0
- package/src/components/cleenIcon/icons/IconLayoutTile.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLifeBuoy.tsx +29 -0
- package/src/components/cleenIcon/icons/IconLightbulb.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLightning.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLightning2.tsx +25 -0
- package/src/components/cleenIcon/icons/IconLightningFast.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLineChartBar.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLineChartBreakoutSquare.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLineChartUp.tsx +25 -0
- package/src/components/cleenIcon/icons/IconLineChartUp2.tsx +34 -0
- package/src/components/cleenIcon/icons/IconLines.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLinesCheck.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLinesPlay.tsx +23 -0
- package/src/components/cleenIcon/icons/IconLink.tsx +25 -0
- package/src/components/cleenIcon/icons/IconLink2.tsx +24 -0
- package/src/components/cleenIcon/icons/IconLink3.tsx +21 -0
- package/src/components/cleenIcon/icons/IconLink4.tsx +17 -0
- package/src/components/cleenIcon/icons/IconLink5.tsx +22 -0
- package/src/components/cleenIcon/icons/IconListBullet.tsx +18 -0
- package/src/components/cleenIcon/icons/IconListOrder.tsx +20 -0
- package/src/components/cleenIcon/icons/IconListOrder2.tsx +16 -0
- package/src/components/cleenIcon/icons/IconLock.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLock2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconLogIn.tsx +25 -0
- package/src/components/cleenIcon/icons/IconLogOut.tsx +25 -0
- package/src/components/cleenIcon/icons/IconLogOut2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconMagicWand.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMagicWand2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconMail.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMessageSquare.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMessageSquare2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconMessageXSquare.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMinusCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconMobile.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMonitor.tsx +22 -0
- package/src/components/cleenIcon/icons/IconMonitor2.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMonitor3.tsx +25 -0
- package/src/components/cleenIcon/icons/IconMoonCircle.tsx +28 -0
- package/src/components/cleenIcon/icons/IconNavigationPointer.tsx +22 -0
- package/src/components/cleenIcon/icons/IconNotificationBox.tsx +22 -0
- package/src/components/cleenIcon/icons/IconPCSetup.tsx +22 -0
- package/src/components/cleenIcon/icons/IconPalette.tsx +40 -0
- package/src/components/cleenIcon/icons/IconPasscodeLock.tsx +25 -0
- package/src/components/cleenIcon/icons/IconPencil.tsx +25 -0
- package/src/components/cleenIcon/icons/IconPercentageCircle.tsx +29 -0
- package/src/components/cleenIcon/icons/IconPerspective.tsx +22 -0
- package/src/components/cleenIcon/icons/IconPhoneCall.tsx +25 -0
- package/src/components/cleenIcon/icons/IconPin.tsx +22 -0
- package/src/components/cleenIcon/icons/IconPlayCircle.tsx +28 -0
- package/src/components/cleenIcon/icons/IconPlus.tsx +22 -0
- package/src/components/cleenIcon/icons/IconPlusCircle.tsx +25 -0
- package/src/components/cleenIcon/icons/IconPulse.tsx +25 -0
- package/src/components/cleenIcon/icons/IconQuestionCircle.tsx +24 -0
- package/src/components/cleenIcon/icons/IconRadioButton.tsx +27 -0
- package/src/components/cleenIcon/icons/IconRadioButtonActive.tsx +39 -0
- package/src/components/cleenIcon/icons/IconReceiptCheck.tsx +25 -0
- package/src/components/cleenIcon/icons/IconRedo.tsx +16 -0
- package/src/components/cleenIcon/icons/IconRefresh.tsx +22 -0
- package/src/components/cleenIcon/icons/IconRefresh2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconRefresh3.tsx +20 -0
- package/src/components/cleenIcon/icons/IconRepeat.tsx +22 -0
- package/src/components/cleenIcon/icons/IconRepeat2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconRetweet.tsx +33 -0
- package/src/components/cleenIcon/icons/IconRoundChart.tsx +25 -0
- package/src/components/cleenIcon/icons/IconRoundChart2.tsx +29 -0
- package/src/components/cleenIcon/icons/IconRoute.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSave.tsx +25 -0
- package/src/components/cleenIcon/icons/IconSave2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconScanDots.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSearch.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSend.tsx +25 -0
- package/src/components/cleenIcon/icons/IconSettings.tsx +32 -0
- package/src/components/cleenIcon/icons/IconSettings2.tsx +25 -0
- package/src/components/cleenIcon/icons/IconSettings3.tsx +22 -0
- package/src/components/cleenIcon/icons/IconShieldLightning.tsx +22 -0
- package/src/components/cleenIcon/icons/IconShieldPlus.tsx +22 -0
- package/src/components/cleenIcon/icons/IconShieldRemove.tsx +16 -0
- package/src/components/cleenIcon/icons/IconShuffle.tsx +25 -0
- package/src/components/cleenIcon/icons/IconSlashCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSlashOctagon.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSocialGlobe.tsx +23 -0
- package/src/components/cleenIcon/icons/IconSocialLinkedin.tsx +21 -0
- package/src/components/cleenIcon/icons/IconSocialX.tsx +28 -0
- package/src/components/cleenIcon/icons/IconSpeedometer.tsx +22 -0
- package/src/components/cleenIcon/icons/IconStairsRound.tsx +21 -0
- package/src/components/cleenIcon/icons/IconStar.tsx +22 -0
- package/src/components/cleenIcon/icons/IconStarHalf.tsx +39 -0
- package/src/components/cleenIcon/icons/IconStars.tsx +28 -0
- package/src/components/cleenIcon/icons/IconStars2.tsx +29 -0
- package/src/components/cleenIcon/icons/IconStrikethrough.tsx +16 -0
- package/src/components/cleenIcon/icons/IconSuccessFeatured.tsx +30 -0
- package/src/components/cleenIcon/icons/IconSun.tsx +22 -0
- package/src/components/cleenIcon/icons/IconSwitchHorizontal.tsx +22 -0
- package/src/components/cleenIcon/icons/IconTag.tsx +22 -0
- package/src/components/cleenIcon/icons/IconTarget.tsx +21 -0
- package/src/components/cleenIcon/icons/IconTarget2.tsx +34 -0
- package/src/components/cleenIcon/icons/IconTextFormat.tsx +17 -0
- package/src/components/cleenIcon/icons/IconTextFormat2.tsx +22 -0
- package/src/components/cleenIcon/icons/IconTextHighlight.tsx +16 -0
- package/src/components/cleenIcon/icons/IconTranslate.tsx +25 -0
- package/src/components/cleenIcon/icons/IconTrash.tsx +25 -0
- package/src/components/cleenIcon/icons/IconTrending.tsx +22 -0
- package/src/components/cleenIcon/icons/IconUnderline.tsx +16 -0
- package/src/components/cleenIcon/icons/IconUndo.tsx +22 -0
- package/src/components/cleenIcon/icons/IconUndo2.tsx +16 -0
- package/src/components/cleenIcon/icons/IconUploadCloud.tsx +22 -0
- package/src/components/cleenIcon/icons/IconUser.tsx +22 -0
- package/src/components/cleenIcon/icons/IconUserEdit.tsx +25 -0
- package/src/components/cleenIcon/icons/IconUserRight.tsx +22 -0
- package/src/components/cleenIcon/icons/IconUserSquare.tsx +25 -0
- package/src/components/cleenIcon/icons/IconUsers.tsx +25 -0
- package/src/components/cleenIcon/icons/IconUsersUp.tsx +25 -0
- package/src/components/cleenIcon/icons/IconVolume.tsx +25 -0
- package/src/components/cleenIcon/icons/IconWrench.tsx +22 -0
- package/src/components/cleenIcon/icons/IconX.tsx +25 -0
- package/src/components/cleenIcon/icons/IconXCircle.tsx +22 -0
- package/src/components/cleenIcon/icons/IconXCircle2.tsx +42 -0
- package/src/components/cleenIcon/icons/IconXClose.tsx +25 -0
- package/src/components/cleenIcon/icons/IconXSquare.tsx +22 -0
- package/src/components/cleenIcon/icons/index.ts +215 -0
- package/src/components/cleenIcon/index.ts +4 -0
- package/src/components/cleenIcon/types/icon.ts +226 -0
- package/src/components/collapsible/Collapsible.tsx +148 -0
- package/src/components/collapsible/index.ts +5 -0
- package/src/components/creditCardInput/CreditCardInput.tsx +236 -0
- package/src/components/creditCardInput/index.ts +2 -0
- package/src/components/creditCardInput/types/card.ts +13 -0
- package/src/components/creditCardInput/types/props.ts +44 -0
- package/src/components/creditCardInput/util/format.ts +102 -0
- package/src/components/datePicker/DatePicker.tsx +235 -0
- package/src/components/datePicker/index.ts +2 -0
- package/src/components/datePicker/types/props.ts +47 -0
- package/src/components/datePicker/utils/date.ts +40 -0
- package/src/components/divider/Divider.tsx +43 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/drawer/Drawer.tsx +222 -0
- package/src/components/drawer/index.ts +1 -0
- package/src/components/dropdown/Dropdown.tsx +224 -0
- package/src/components/dropdown/index.ts +1 -0
- package/src/components/filterDrawer/FilterDrawer.tsx +147 -0
- package/src/components/filterDrawer/blocks/FilterDrawerFooter.tsx +119 -0
- package/src/components/filterDrawer/blocks/SaveFilterStep.tsx +56 -0
- package/src/components/filterDrawer/blocks/SavedFilterRow.tsx +166 -0
- package/src/components/filterDrawer/blocks/SavedFiltersDropdown.tsx +142 -0
- package/src/components/filterDrawer/constants/filter.ts +4 -0
- package/src/components/filterDrawer/constants/labels.ts +52 -0
- package/src/components/filterDrawer/constants/tab.ts +7 -0
- package/src/components/filterDrawer/context/context.ts +28 -0
- package/src/components/filterDrawer/context/provider.tsx +50 -0
- package/src/components/filterDrawer/index.ts +7 -0
- package/src/components/filterDrawer/types/filters.ts +28 -0
- package/src/components/filterDrawer/types/props.ts +107 -0
- package/src/components/filterDrawer/types/validation.ts +6 -0
- package/src/components/formGroup/FormGroup.tsx +165 -0
- package/src/components/formGroup/index.ts +1 -0
- package/src/components/groupSelector/GroupSelector.tsx +729 -0
- package/src/components/groupSelector/index.ts +6 -0
- package/src/components/index.ts +44 -0
- package/src/components/infoLabels/InfoLabels.tsx +88 -0
- package/src/components/infoLabels/index.ts +1 -0
- package/src/components/input/Input.tsx +269 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/loader/Loader.tsx +91 -0
- package/src/components/loader/index.ts +1 -0
- package/src/components/lookup/Lookup.tsx +433 -0
- package/src/components/lookup/blocks/LookupOptionList.tsx +130 -0
- package/src/components/lookup/index.ts +2 -0
- package/src/components/lookup/types/lookup.ts +97 -0
- package/src/components/menu/Menu.tsx +103 -0
- package/src/components/menu/blocks/MenuContent.tsx +105 -0
- package/src/components/menu/blocks/MenuItem.tsx +120 -0
- package/src/components/menu/index.ts +2 -0
- package/src/components/menu/types/menu.ts +30 -0
- package/src/components/menu/types/menuItem.ts +48 -0
- package/src/components/modal/Modal.tsx +191 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/notification/Notification.tsx +79 -0
- package/src/components/notification/constant/notification.ts +30 -0
- package/src/components/notification/index.ts +2 -0
- package/src/components/notification/wrappers/CleenNotificationContainer.tsx +9 -0
- package/src/components/pagination/Pagination.tsx +294 -0
- package/src/components/pagination/blocks/PaginationGoToPage.tsx +91 -0
- package/src/components/pagination/blocks/PaginationPageSize.tsx +145 -0
- package/src/components/pagination/constants/labels.ts +15 -0
- package/src/components/pagination/index.ts +9 -0
- package/src/components/pillBadge/PillBadge.tsx +130 -0
- package/src/components/pillBadge/helper.ts +11 -0
- package/src/components/pillBadge/index.ts +1 -0
- package/src/components/pillBadge/variants.ts +47 -0
- package/src/components/popover/Popover.tsx +108 -0
- package/src/components/popover/index.ts +2 -0
- package/src/components/popover/types/popover.ts +21 -0
- package/src/components/progressBar/ProgressBar.tsx +179 -0
- package/src/components/progressBar/index.ts +1 -0
- package/src/components/progressCircle/ProgressCircle.tsx +142 -0
- package/src/components/progressCircle/index.ts +1 -0
- package/src/components/radioBoxGroup/RadioBoxGroup.tsx +207 -0
- package/src/components/radioBoxGroup/index.ts +1 -0
- package/src/components/radioButtonGroup/RadioButtonGroup.tsx +208 -0
- package/src/components/radioButtonGroup/blocks/RadioButton.tsx +22 -0
- package/src/components/radioButtonGroup/index.ts +4 -0
- package/src/components/radioButtonGroup/types/radioButton.ts +10 -0
- package/src/components/rangeSlider/RangeSlider.tsx +366 -0
- package/src/components/rangeSlider/index.ts +1 -0
- package/src/components/select/Select.tsx +349 -0
- package/src/components/select/blocks/SelectCustomMenuList.tsx +70 -0
- package/src/components/select/blocks/SelectNoOptionsMessage.tsx +22 -0
- package/src/components/select/blocks/SelectOption.tsx +19 -0
- package/src/components/select/blocks/SelectSingleValue.tsx +28 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/sidebar/Sidebar.tsx +210 -0
- package/src/components/sidebar/SidebarItem.tsx +88 -0
- package/src/components/sidebar/drawerContainer/DrawerContainer.tsx +36 -0
- package/src/components/sidebar/drawerContainer/DrawerContentTitle.tsx +165 -0
- package/src/components/sidebar/drawerContainer/index.ts +2 -0
- package/src/components/sidebar/index.ts +13 -0
- package/src/components/sidebar/types.ts +157 -0
- package/src/components/skeletons/blocks/Skeleton.tsx +72 -0
- package/src/components/skeletons/blocks/SkeletonAvatar.tsx +43 -0
- package/src/components/skeletons/blocks/SkeletonBadge.tsx +30 -0
- package/src/components/skeletons/blocks/SkeletonBanner.tsx +44 -0
- package/src/components/skeletons/blocks/SkeletonButton.tsx +31 -0
- package/src/components/skeletons/blocks/SkeletonCard.tsx +39 -0
- package/src/components/skeletons/blocks/SkeletonCard2.tsx +57 -0
- package/src/components/skeletons/blocks/SkeletonCard3.tsx +89 -0
- package/src/components/skeletons/blocks/SkeletonCardStack.tsx +22 -0
- package/src/components/skeletons/blocks/SkeletonChart.tsx +114 -0
- package/src/components/skeletons/blocks/SkeletonContentCard.tsx +75 -0
- package/src/components/skeletons/blocks/SkeletonDataGrid.tsx +73 -0
- package/src/components/skeletons/blocks/SkeletonForm.tsx +50 -0
- package/src/components/skeletons/blocks/SkeletonImage.tsx +45 -0
- package/src/components/skeletons/blocks/SkeletonInfoCard.tsx +130 -0
- package/src/components/skeletons/blocks/SkeletonInput.tsx +32 -0
- package/src/components/skeletons/blocks/SkeletonList.tsx +67 -0
- package/src/components/skeletons/blocks/SkeletonParagraph.tsx +52 -0
- package/src/components/skeletons/blocks/SkeletonText.tsx +22 -0
- package/src/components/skeletons/blocks/SkeletonVideo.tsx +71 -0
- package/src/components/skeletons/blocks/SkeletonWidgetCard.tsx +56 -0
- package/src/components/skeletons/blocks/SkeletonWrapper.tsx +140 -0
- package/src/components/skeletons/index.ts +24 -0
- package/src/components/skeletons/styles/skeleton.ts +2 -0
- package/src/components/skeletons/types/skeleton.ts +8 -0
- package/src/components/slider/Slider.tsx +298 -0
- package/src/components/slider/index.ts +1 -0
- package/src/components/stepper/Stepper.tsx +185 -0
- package/src/components/stepper/index.ts +1 -0
- package/src/components/switch/Switch.tsx +152 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/tabs/Tabs.tsx +140 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/types/tab.ts +33 -0
- package/src/components/tabs/variants.ts +49 -0
- package/src/components/textArea/TextArea.tsx +244 -0
- package/src/components/textArea/index.ts +1 -0
- package/src/components/tooltip/Tooltip.tsx +200 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/icons/IconFromLibrary.tsx +13 -0
- package/src/icons/getIconByName.ts +81 -0
- package/src/icons/index.ts +16 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +27 -0
- package/tsup.config.ts +23 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { cn } from '@cleen/ui-core';
|
|
2
|
+
import type {
|
|
3
|
+
ComponentProps,
|
|
4
|
+
CSSProperties,
|
|
5
|
+
ForwardedRef,
|
|
6
|
+
ReactNode,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
|
|
10
|
+
export interface Step {
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
subtitle?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface StepperProps extends ComponentProps<'div'> {
|
|
16
|
+
steps?: Step[];
|
|
17
|
+
activeStep?: number;
|
|
18
|
+
orientation?: 'horizontal' | 'vertical';
|
|
19
|
+
color?: string;
|
|
20
|
+
classNames?: {
|
|
21
|
+
container?: string;
|
|
22
|
+
step?: string;
|
|
23
|
+
circle?: string;
|
|
24
|
+
connector?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
};
|
|
28
|
+
styles?: {
|
|
29
|
+
container?: CSSProperties;
|
|
30
|
+
step?: CSSProperties;
|
|
31
|
+
circle?: CSSProperties;
|
|
32
|
+
connector?: CSSProperties;
|
|
33
|
+
title?: CSSProperties;
|
|
34
|
+
subtitle?: CSSProperties;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Step-progress indicator rendered horizontally or vertically.
|
|
40
|
+
*
|
|
41
|
+
* - Pass `steps` as an array of `{ title?, subtitle? }` objects.
|
|
42
|
+
* - Control the active step with `activeStep` (1-based index).
|
|
43
|
+
* - Toggle layout with `orientation` (`horizontal` | `vertical`).
|
|
44
|
+
* - Override the accent color with `color`.
|
|
45
|
+
* - Accepts `classNames` and `styles` for keys: `container`, `step`, `circle`, `connector`, `title`, `subtitle`.
|
|
46
|
+
*/
|
|
47
|
+
export const Stepper = forwardRef<HTMLDivElement, StepperProps>(
|
|
48
|
+
(
|
|
49
|
+
{
|
|
50
|
+
steps,
|
|
51
|
+
activeStep = 0,
|
|
52
|
+
orientation = 'horizontal',
|
|
53
|
+
color = 'rgb(var(--cleen-primary))',
|
|
54
|
+
className,
|
|
55
|
+
classNames,
|
|
56
|
+
style,
|
|
57
|
+
styles,
|
|
58
|
+
...props
|
|
59
|
+
},
|
|
60
|
+
ref: ForwardedRef<HTMLDivElement>
|
|
61
|
+
) => {
|
|
62
|
+
const isVertical = orientation === 'vertical';
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={cn('cleen', className)}
|
|
68
|
+
style={{ ...style, width: '100%' }}
|
|
69
|
+
{...props}
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
className={cn(
|
|
73
|
+
'cleen-flex cleen-w-full',
|
|
74
|
+
isVertical
|
|
75
|
+
? 'cleen-flex-col cleen-gap-6'
|
|
76
|
+
: 'cleen-flex-row cleen-items-start cleen-gap-8 cleen-justify-between',
|
|
77
|
+
classNames?.container
|
|
78
|
+
)}
|
|
79
|
+
style={{ width: '100%', ...styles?.container }}
|
|
80
|
+
>
|
|
81
|
+
{steps?.map((step, index) => {
|
|
82
|
+
const isCompleted = index + 1 < activeStep;
|
|
83
|
+
const isActive = index + 1 === activeStep;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
key={index}
|
|
88
|
+
className={cn(
|
|
89
|
+
'cleen-relative cleen-flex cleen-flex-1',
|
|
90
|
+
isVertical
|
|
91
|
+
? 'cleen-flex-row cleen-items-start'
|
|
92
|
+
: 'cleen-flex-col cleen-items-center cleen-text-center',
|
|
93
|
+
classNames?.step
|
|
94
|
+
)}
|
|
95
|
+
style={styles?.step}
|
|
96
|
+
>
|
|
97
|
+
{index < steps?.length - 1 && (
|
|
98
|
+
<div
|
|
99
|
+
className={cn(
|
|
100
|
+
'cleen-absolute cleen-bg-gray/10 cleen-transition-all cleen-duration-300',
|
|
101
|
+
isVertical
|
|
102
|
+
? 'cleen-left-3 cleen-top-7 cleen-w-[2px] cleen-h-[calc(100%-4px)]'
|
|
103
|
+
: 'cleen-top-3 cleen-left-[calc(50%+14px)] cleen-h-[2px] cleen-w-[calc(100%+4px)]',
|
|
104
|
+
isCompleted && 'cleen-bg-primary',
|
|
105
|
+
classNames?.connector
|
|
106
|
+
)}
|
|
107
|
+
style={{
|
|
108
|
+
backgroundColor: isCompleted ? color : undefined,
|
|
109
|
+
...styles?.connector,
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
<div
|
|
114
|
+
className={cn(
|
|
115
|
+
'cleen-relative cleen-z-10 cleen-flex cleen-items-center cleen-justify-center cleen-rounded-full cleen-border cleen-transition-all cleen-duration-300',
|
|
116
|
+
'cleen-size-7',
|
|
117
|
+
isCompleted || isActive
|
|
118
|
+
? 'cleen-border-[2px]'
|
|
119
|
+
: 'cleen-border-gray/30',
|
|
120
|
+
classNames?.circle
|
|
121
|
+
)}
|
|
122
|
+
style={{
|
|
123
|
+
borderColor: isActive || isCompleted ? color : undefined,
|
|
124
|
+
backgroundColor: isCompleted ? color : 'transparent',
|
|
125
|
+
...styles?.circle,
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{isCompleted ? (
|
|
129
|
+
<span className="cleen-text-white cleen-text-sm">✓</span>
|
|
130
|
+
) : (
|
|
131
|
+
<span
|
|
132
|
+
className={cn(
|
|
133
|
+
'cleen-w-2 cleen-h-2 cleen-rounded-full',
|
|
134
|
+
isActive ? 'cleen-bg-white' : 'cleen-bg-gray/30'
|
|
135
|
+
)}
|
|
136
|
+
style={{ backgroundColor: isActive ? color : undefined }}
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
<div
|
|
141
|
+
className={cn(
|
|
142
|
+
'cleen-flex cleen-flex-col',
|
|
143
|
+
isVertical ? 'cleen-ml-3' : 'cleen-mt-3 cleen-items-center'
|
|
144
|
+
)}
|
|
145
|
+
>
|
|
146
|
+
{step.title && (
|
|
147
|
+
<div
|
|
148
|
+
className={cn(
|
|
149
|
+
'cleen-font-medium cleen-text-sm',
|
|
150
|
+
isActive ? 'cleen-text-primary' : 'cleen-text-gray',
|
|
151
|
+
classNames?.title
|
|
152
|
+
)}
|
|
153
|
+
style={{
|
|
154
|
+
color: isActive ? color : undefined,
|
|
155
|
+
...styles?.title,
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
{step.title}
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
{step.subtitle && (
|
|
162
|
+
<div
|
|
163
|
+
className={cn(
|
|
164
|
+
'cleen-text-xs cleen-text-gray/70',
|
|
165
|
+
classNames?.subtitle
|
|
166
|
+
)}
|
|
167
|
+
style={{
|
|
168
|
+
color: isActive ? color : undefined,
|
|
169
|
+
...styles?.subtitle,
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{step.subtitle}
|
|
173
|
+
</div>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
})}
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
Stepper.displayName = 'Stepper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stepper, type StepperProps } from './Stepper';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InfoLabels,
|
|
3
|
+
type InfoLabelsProps,
|
|
4
|
+
} from '@/components/infoLabels/InfoLabels';
|
|
5
|
+
import { cn } from '@cleen/ui-core';
|
|
6
|
+
import {
|
|
7
|
+
useEffect,
|
|
8
|
+
useState,
|
|
9
|
+
type ComponentProps,
|
|
10
|
+
type CSSProperties,
|
|
11
|
+
type ReactNode,
|
|
12
|
+
} from 'react';
|
|
13
|
+
|
|
14
|
+
export type SwitchProps = Omit<
|
|
15
|
+
ComponentProps<'button'>,
|
|
16
|
+
'onChange' | 'title'
|
|
17
|
+
> & {
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
defaultChecked?: boolean;
|
|
20
|
+
title?: ReactNode;
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
sublabel?: ReactNode;
|
|
23
|
+
onChange?: (value: boolean) => void;
|
|
24
|
+
infoLabels?: InfoLabelsProps;
|
|
25
|
+
classNames?: {
|
|
26
|
+
container?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
switch?: string;
|
|
29
|
+
check?: string;
|
|
30
|
+
};
|
|
31
|
+
styles?: {
|
|
32
|
+
container?: CSSProperties;
|
|
33
|
+
title?: CSSProperties;
|
|
34
|
+
switch?: CSSProperties;
|
|
35
|
+
check?: CSSProperties;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Toggle switch for boolean on/off input with optional title, label, sub-label, and info messages.
|
|
41
|
+
*
|
|
42
|
+
* - Supports controlled mode via `checked` + `onChange`, and uncontrolled via `defaultChecked`.
|
|
43
|
+
* - Pass `title` for a heading row above the switch, `label` for primary text, and `sublabel` for secondary text beside it.
|
|
44
|
+
* - Accepts `classNames` and `styles` for keys: `container`, `title`, `switch`, `check`.
|
|
45
|
+
*/
|
|
46
|
+
export const Switch = ({
|
|
47
|
+
checked,
|
|
48
|
+
defaultChecked = false,
|
|
49
|
+
onChange,
|
|
50
|
+
title,
|
|
51
|
+
label,
|
|
52
|
+
sublabel,
|
|
53
|
+
disabled,
|
|
54
|
+
classNames,
|
|
55
|
+
className,
|
|
56
|
+
style,
|
|
57
|
+
styles,
|
|
58
|
+
infoLabels,
|
|
59
|
+
...props
|
|
60
|
+
}: SwitchProps) => {
|
|
61
|
+
const isControlled = typeof checked === 'boolean';
|
|
62
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!isControlled) {
|
|
66
|
+
setInternalChecked(defaultChecked);
|
|
67
|
+
}
|
|
68
|
+
}, [defaultChecked, isControlled]);
|
|
69
|
+
|
|
70
|
+
const currentChecked = isControlled ? checked! : internalChecked;
|
|
71
|
+
|
|
72
|
+
const handleClick = () => {
|
|
73
|
+
if (!disabled) {
|
|
74
|
+
if (!isControlled) {
|
|
75
|
+
setInternalChecked(!internalChecked);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onChange?.(!currentChecked);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className={cn('cleen', className)} style={style}>
|
|
84
|
+
<div
|
|
85
|
+
className={cn(
|
|
86
|
+
'cleen-flex cleen-flex-col cleen-gap-2.5',
|
|
87
|
+
classNames?.container
|
|
88
|
+
)}
|
|
89
|
+
style={styles?.container}
|
|
90
|
+
>
|
|
91
|
+
{title && (
|
|
92
|
+
<label
|
|
93
|
+
className={cn(
|
|
94
|
+
'cleen-block cleen-mb-1.5 cleen-font-medium cleen-text-gray/90 cleen-text-sm cleen-leading-6',
|
|
95
|
+
classNames?.title
|
|
96
|
+
)}
|
|
97
|
+
style={styles?.title}
|
|
98
|
+
>
|
|
99
|
+
{title}
|
|
100
|
+
</label>
|
|
101
|
+
)}
|
|
102
|
+
|
|
103
|
+
<div className="cleen-flex cleen-items-center cleen-gap-2 cleen-w-full">
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
onClick={handleClick}
|
|
108
|
+
className={cn(
|
|
109
|
+
'cleen-inline-flex cleen-relative cleen-flex-shrink-0 cleen-my-auto cleen-mb-auto cleen-border-2 cleen-border-transparent cleen-rounded-full cleen-w-11 cleen-h-6 cleen-transition-colors cleen-duration-200 cleen-ease-in-out cleen-cursor-pointer',
|
|
110
|
+
currentChecked
|
|
111
|
+
? 'cleen-bg-primary hover:cleen-bg-primary/90'
|
|
112
|
+
: 'cleen-bg-gray/20 hover:cleen-bg-gray/30',
|
|
113
|
+
classNames?.switch
|
|
114
|
+
)}
|
|
115
|
+
style={styles?.switch}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<span
|
|
119
|
+
aria-hidden="true"
|
|
120
|
+
className={cn(
|
|
121
|
+
'cleen-inline-block cleen-bg-white cleen-shadow cleen-rounded-full cleen-ring-0 cleen-w-5 cleen-h-5 cleen-transition cleen-duration-200 cleen-ease-in-out cleen-pointer-events-none cleen-transform',
|
|
122
|
+
currentChecked ? 'cleen-translate-x-5' : 'cleen-translate-x-0',
|
|
123
|
+
classNames?.check
|
|
124
|
+
)}
|
|
125
|
+
style={styles?.check}
|
|
126
|
+
/>
|
|
127
|
+
</button>
|
|
128
|
+
|
|
129
|
+
{(label || sublabel) && (
|
|
130
|
+
<div className="cleen-flex cleen-flex-col cleen-text-sm">
|
|
131
|
+
{label && (
|
|
132
|
+
<span className="cleen-font-semibold cleen-text-gray/90">
|
|
133
|
+
{label}
|
|
134
|
+
</span>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
{sublabel && (
|
|
138
|
+
<span className="cleen-font-normal cleen-text-gray/80">
|
|
139
|
+
{sublabel}
|
|
140
|
+
</span>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{(infoLabels?.errorMessage ||
|
|
147
|
+
infoLabels?.infoMessage ||
|
|
148
|
+
infoLabels?.subtitle) && <InfoLabels {...infoLabels} />}
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch, type SwitchProps } from './Switch';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { PillBadge } from '@/components/pillBadge';
|
|
2
|
+
import { cn } from '@cleen/ui-core';
|
|
3
|
+
import { forwardRef, useMemo, useState, type ComponentProps } from 'react';
|
|
4
|
+
import type { Tab, TabsClassNames, TabsStyles } from './types/tab';
|
|
5
|
+
import { directions, variants, type Direction, type Variant } from './variants';
|
|
6
|
+
|
|
7
|
+
export type TabsProps = ComponentProps<'div'> & {
|
|
8
|
+
tabs?: Tab[];
|
|
9
|
+
currentTabIndex?: number;
|
|
10
|
+
onTabChange?: (index: number, tab?: Tab) => void;
|
|
11
|
+
variant?: Variant;
|
|
12
|
+
direction?: Direction;
|
|
13
|
+
classNames?: TabsClassNames;
|
|
14
|
+
styles?: TabsStyles;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The `Tabs` component displays a set of selectable tabs, allowing users to switch between different views or content sections within an application.
|
|
19
|
+
* It supports controlled and uncontrolled modes, custom styling, and optional tab counts.
|
|
20
|
+
*/
|
|
21
|
+
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs(
|
|
22
|
+
{
|
|
23
|
+
tabs,
|
|
24
|
+
variant = 'underlined',
|
|
25
|
+
direction = 'horizontal',
|
|
26
|
+
currentTabIndex,
|
|
27
|
+
onTabChange,
|
|
28
|
+
className,
|
|
29
|
+
classNames,
|
|
30
|
+
style,
|
|
31
|
+
styles,
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
34
|
+
ref
|
|
35
|
+
) {
|
|
36
|
+
const [internalCurrentTabIndex, setInternalCurrentTabIndex] = useState(0);
|
|
37
|
+
const isControlled = currentTabIndex !== undefined;
|
|
38
|
+
const finalTabIndex = isControlled
|
|
39
|
+
? currentTabIndex
|
|
40
|
+
: internalCurrentTabIndex;
|
|
41
|
+
|
|
42
|
+
const currentTab = useMemo(
|
|
43
|
+
() => tabs?.[finalTabIndex],
|
|
44
|
+
[tabs, finalTabIndex]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const handleTabClick = (index: number, tab: Tab) => {
|
|
48
|
+
setInternalCurrentTabIndex(index);
|
|
49
|
+
|
|
50
|
+
onTabChange?.(index, tab);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const variantClasses = useMemo(() => variants(direction), [direction]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className={cn('cleen', className)} style={style} ref={ref} {...props}>
|
|
57
|
+
<div
|
|
58
|
+
className={cn(directions[direction].container, classNames?.container)}
|
|
59
|
+
style={styles?.container}
|
|
60
|
+
>
|
|
61
|
+
<nav
|
|
62
|
+
className={cn(
|
|
63
|
+
variantClasses[variant].list,
|
|
64
|
+
directions[direction].list,
|
|
65
|
+
classNames?.list
|
|
66
|
+
)}
|
|
67
|
+
aria-label="Tabs"
|
|
68
|
+
style={styles?.list}
|
|
69
|
+
>
|
|
70
|
+
{tabs?.map((tab, index) => {
|
|
71
|
+
const isSelected = finalTabIndex === index;
|
|
72
|
+
const isDisabled = tab?.isDisabled;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<span
|
|
76
|
+
key={tab?.id || index}
|
|
77
|
+
onClick={() => !isDisabled && handleTabClick(index, tab)}
|
|
78
|
+
className={cn(
|
|
79
|
+
'cleen-flex cleen-items-center cleen-gap-2 cleen-whitespace-nowrap',
|
|
80
|
+
!isDisabled && 'cleen-cursor-pointer',
|
|
81
|
+
variantClasses[variant].tab,
|
|
82
|
+
directions[direction].tab,
|
|
83
|
+
classNames?.tab,
|
|
84
|
+
isDisabled
|
|
85
|
+
? cn(
|
|
86
|
+
variantClasses[variant].tabDisabled,
|
|
87
|
+
classNames?.tabDisabled
|
|
88
|
+
)
|
|
89
|
+
: isSelected
|
|
90
|
+
? cn(
|
|
91
|
+
variantClasses[variant].tabActive,
|
|
92
|
+
classNames?.tabActive
|
|
93
|
+
)
|
|
94
|
+
: cn(
|
|
95
|
+
variantClasses[variant].tabInactive,
|
|
96
|
+
classNames?.tabInactive
|
|
97
|
+
)
|
|
98
|
+
)}
|
|
99
|
+
style={{
|
|
100
|
+
...styles?.tab,
|
|
101
|
+
...(isDisabled
|
|
102
|
+
? styles?.tabDisabled
|
|
103
|
+
: isSelected
|
|
104
|
+
? styles?.tabActive
|
|
105
|
+
: styles?.tabInactive),
|
|
106
|
+
}}
|
|
107
|
+
aria-current={isSelected ? 'page' : undefined}
|
|
108
|
+
aria-disabled={isDisabled}
|
|
109
|
+
>
|
|
110
|
+
{tab?.label}
|
|
111
|
+
{!!tab?.badge?.label && (
|
|
112
|
+
<PillBadge
|
|
113
|
+
variant="rounded"
|
|
114
|
+
color={isSelected ? 'blue' : 'gray'}
|
|
115
|
+
{...classNames?.count}
|
|
116
|
+
{...styles?.count}
|
|
117
|
+
{...tab.badge}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
</span>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</nav>
|
|
124
|
+
|
|
125
|
+
{!!currentTab?.content && (
|
|
126
|
+
<div
|
|
127
|
+
className={cn(
|
|
128
|
+
'h-full',
|
|
129
|
+
directions[direction].content,
|
|
130
|
+
classNames?.content
|
|
131
|
+
)}
|
|
132
|
+
style={styles?.content}
|
|
133
|
+
>
|
|
134
|
+
{currentTab?.content}
|
|
135
|
+
</div>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PillBadgeProps } from '@/components/pillBadge/PillBadge';
|
|
2
|
+
import type { ComponentClassnames, ComponentStyles } from '@cleen/ui-core';
|
|
3
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export interface Tab {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
badge?: PillBadgeProps;
|
|
9
|
+
content?: ReactNode;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TabsClassNames {
|
|
14
|
+
container?: string;
|
|
15
|
+
list?: string;
|
|
16
|
+
tab?: string;
|
|
17
|
+
tabActive?: string;
|
|
18
|
+
tabInactive?: string;
|
|
19
|
+
tabDisabled?: string;
|
|
20
|
+
count?: ComponentClassnames<PillBadgeProps>;
|
|
21
|
+
content?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TabsStyles {
|
|
25
|
+
container?: CSSProperties;
|
|
26
|
+
list?: CSSProperties;
|
|
27
|
+
tab?: CSSProperties;
|
|
28
|
+
tabActive?: CSSProperties;
|
|
29
|
+
tabInactive?: CSSProperties;
|
|
30
|
+
tabDisabled?: CSSProperties;
|
|
31
|
+
count?: ComponentStyles<PillBadgeProps>;
|
|
32
|
+
content?: CSSProperties;
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TabsClassNames } from '@/components/tabs/types/tab';
|
|
2
|
+
import { cn } from '@cleen/ui-core';
|
|
3
|
+
|
|
4
|
+
export type Direction = 'horizontal' | 'vertical';
|
|
5
|
+
export type Variant = 'underlined' | 'padded';
|
|
6
|
+
|
|
7
|
+
export const directions: Record<Direction, TabsClassNames> = {
|
|
8
|
+
horizontal: {
|
|
9
|
+
list: 'cleen-flex cleen-flex-wrap cleen-mb-4',
|
|
10
|
+
},
|
|
11
|
+
vertical: {
|
|
12
|
+
container: 'cleen-flex cleen-gap-4',
|
|
13
|
+
list: 'cleen-flex cleen-flex-col',
|
|
14
|
+
content: 'cleen-flex-1',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const variants: (
|
|
19
|
+
direction: keyof typeof directions
|
|
20
|
+
) => Record<Variant, TabsClassNames> = direction => {
|
|
21
|
+
const isVertical = direction === 'vertical';
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
underlined: {
|
|
25
|
+
list: cn(
|
|
26
|
+
'cleen-gap-2 cleen-border-gray/10',
|
|
27
|
+
!isVertical && 'cleen-border-b'
|
|
28
|
+
),
|
|
29
|
+
tab: cn(
|
|
30
|
+
'cleen-px-1 cleen-font-semibold cleen-text-sm cleen-transition-all cleen-duration-200',
|
|
31
|
+
isVertical
|
|
32
|
+
? 'cleen-border-l-2 cleen-pl-3 cleen-py-1.5'
|
|
33
|
+
: 'cleen-border-b-2 cleen-pb-3'
|
|
34
|
+
),
|
|
35
|
+
tabActive: 'cleen-border-primary cleen-text-primary',
|
|
36
|
+
tabInactive:
|
|
37
|
+
'cleen-border-transparent cleen-text-gray/70 hover:cleen-border-gray/10',
|
|
38
|
+
tabDisabled:
|
|
39
|
+
'cleen-border-transparent cleen-text-gray/40 cleen-cursor-not-allowed',
|
|
40
|
+
},
|
|
41
|
+
padded: {
|
|
42
|
+
list: 'cleen-gap-1',
|
|
43
|
+
tab: 'cleen-px-3 cleen-py-2.5 cleen-rounded-md cleen-font-semibold cleen-text-sm cleen-transition-all cleen-duration-200',
|
|
44
|
+
tabActive: 'cleen-bg-primary/10 cleen-text-primary',
|
|
45
|
+
tabInactive: 'cleen-text-gray/70 hover:cleen-bg-gray/10',
|
|
46
|
+
tabDisabled: 'cleen-text-gray/40 cleen-cursor-not-allowed',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|