@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,103 @@
|
|
|
1
|
+
import { MenuContent } from '@/components/menu/blocks/MenuContent';
|
|
2
|
+
import {
|
|
3
|
+
cn,
|
|
4
|
+
useDisclosure,
|
|
5
|
+
useOutsideClick,
|
|
6
|
+
usePositionClose,
|
|
7
|
+
} from '@cleen/ui-core';
|
|
8
|
+
import { forwardRef, useRef, type MouseEvent as ReactMouseEvent } from 'react';
|
|
9
|
+
import { createPortal } from 'react-dom';
|
|
10
|
+
import type { MenuProps } from './types/menu';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `Menu` component displays a list of selectable items, typically used for navigation or actions. It appears when triggered and can be positioned relative to its trigger element, automatically adjusting to fit within the viewport.
|
|
14
|
+
*/
|
|
15
|
+
export const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu(
|
|
16
|
+
{
|
|
17
|
+
items = [],
|
|
18
|
+
position = 'bottom-left',
|
|
19
|
+
keepOpenOnClick = true,
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
classNames,
|
|
23
|
+
style,
|
|
24
|
+
styles,
|
|
25
|
+
...props
|
|
26
|
+
},
|
|
27
|
+
ref
|
|
28
|
+
) {
|
|
29
|
+
const { isOpen, toggle, close } = useDisclosure();
|
|
30
|
+
|
|
31
|
+
const triggerRef = useRef<HTMLDivElement>(null);
|
|
32
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
|
|
34
|
+
// Calculate optimal position and handle click-outside =w=
|
|
35
|
+
const { positionStyles, isMounted } = usePositionClose({
|
|
36
|
+
triggerRef,
|
|
37
|
+
targetRef: menuRef,
|
|
38
|
+
position,
|
|
39
|
+
isOpen,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
useOutsideClick({
|
|
43
|
+
refs: [triggerRef, menuRef],
|
|
44
|
+
handler: close,
|
|
45
|
+
enabled: isOpen,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const handleTriggerClick = (e: ReactMouseEvent) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
toggle();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={cn('cleen', className)} style={style} ref={ref} {...props}>
|
|
55
|
+
<div
|
|
56
|
+
ref={triggerRef}
|
|
57
|
+
onClick={handleTriggerClick}
|
|
58
|
+
className={cn(
|
|
59
|
+
'cleen-size-fit',
|
|
60
|
+
classNames?.trigger,
|
|
61
|
+
isOpen && classNames?.triggerOpen
|
|
62
|
+
)}
|
|
63
|
+
style={{
|
|
64
|
+
...styles?.trigger,
|
|
65
|
+
...(isOpen ? styles?.triggerOpen : {}),
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{isOpen &&
|
|
72
|
+
createPortal(
|
|
73
|
+
<div className="cleen">
|
|
74
|
+
<div
|
|
75
|
+
ref={menuRef}
|
|
76
|
+
className={cn(
|
|
77
|
+
'cleen-bg-background cleen-shadow-lg cleen-border cleen-border-gray/20 cleen-rounded-lg cleen-w-52',
|
|
78
|
+
'cleen-absolute cleen-z-50',
|
|
79
|
+
{
|
|
80
|
+
'cleen-opacity-0': !isMounted,
|
|
81
|
+
},
|
|
82
|
+
classNames?.menu
|
|
83
|
+
)}
|
|
84
|
+
style={{
|
|
85
|
+
top: `${positionStyles.top}px`,
|
|
86
|
+
left: `${positionStyles.left}px`,
|
|
87
|
+
...styles?.menu,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<MenuContent
|
|
91
|
+
items={items}
|
|
92
|
+
keepOpenOnClick={keepOpenOnClick}
|
|
93
|
+
hideMenu={close}
|
|
94
|
+
classNames={classNames}
|
|
95
|
+
styles={styles}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
</div>,
|
|
99
|
+
document.body
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IconChevronLeft } from '@/components/cleenIcon';
|
|
2
|
+
import { MenuItem } from '@/components/menu/blocks/MenuItem';
|
|
3
|
+
import type { MenuProps, MenuStack } from '@/components/menu/types/menu';
|
|
4
|
+
import type {
|
|
5
|
+
IMenuItem,
|
|
6
|
+
MenuItemButton,
|
|
7
|
+
} from '@/components/menu/types/menuItem';
|
|
8
|
+
import { cn } from '@cleen/ui-core';
|
|
9
|
+
import { useEffect, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
interface MenuContentProps {
|
|
12
|
+
items: IMenuItem[];
|
|
13
|
+
keepOpenOnClick?: boolean;
|
|
14
|
+
hideMenu: () => void;
|
|
15
|
+
classNames: MenuProps['classNames'];
|
|
16
|
+
styles: MenuProps['styles'];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const MenuContent = ({
|
|
20
|
+
items,
|
|
21
|
+
keepOpenOnClick,
|
|
22
|
+
hideMenu,
|
|
23
|
+
classNames,
|
|
24
|
+
styles,
|
|
25
|
+
}: MenuContentProps) => {
|
|
26
|
+
const [menuStack, setMenuStack] = useState<MenuStack[]>([]);
|
|
27
|
+
const [activeItems, setActiveItems] = useState<IMenuItem[]>(items);
|
|
28
|
+
|
|
29
|
+
const enterSubmenu = (submenu: IMenuItem[], title?: React.ReactNode) => {
|
|
30
|
+
setMenuStack(stack => [...stack, { items: activeItems, title }]);
|
|
31
|
+
setActiveItems(submenu);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const goBack = () => {
|
|
35
|
+
const previous = menuStack[menuStack?.length - 1];
|
|
36
|
+
if (!previous) return;
|
|
37
|
+
|
|
38
|
+
setActiveItems(previous?.items);
|
|
39
|
+
setMenuStack(stack => stack?.slice(0, -1));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setActiveItems(items);
|
|
44
|
+
setMenuStack([]);
|
|
45
|
+
}, [items]);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const handleEscape = (e: KeyboardEvent) => {
|
|
49
|
+
if (e.key !== 'Escape') return;
|
|
50
|
+
|
|
51
|
+
if (menuStack.length > 0) {
|
|
52
|
+
const previous = menuStack?.[menuStack?.length - 1];
|
|
53
|
+
|
|
54
|
+
setActiveItems(previous?.items);
|
|
55
|
+
setMenuStack(stack => stack?.slice(0, -1));
|
|
56
|
+
} else {
|
|
57
|
+
hideMenu();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
document.addEventListener('keydown', handleEscape);
|
|
62
|
+
|
|
63
|
+
return () => {
|
|
64
|
+
document.removeEventListener('keydown', handleEscape);
|
|
65
|
+
};
|
|
66
|
+
}, [hideMenu, menuStack]);
|
|
67
|
+
|
|
68
|
+
const handleItemClick = (item: MenuItemButton) => {
|
|
69
|
+
item?.onClick?.();
|
|
70
|
+
|
|
71
|
+
if (!keepOpenOnClick) {
|
|
72
|
+
hideMenu();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
{menuStack?.length > 0 && (
|
|
79
|
+
<button
|
|
80
|
+
onClick={goBack}
|
|
81
|
+
className={cn(
|
|
82
|
+
'cleen-flex cleen-items-center cleen-gap-3 cleen-px-4 cleen-py-2 cleen-w-full cleen-text-sm cleen-text-gray hover:cleen-bg-gray/5',
|
|
83
|
+
classNames?.submenuButton
|
|
84
|
+
)}
|
|
85
|
+
style={styles?.submenuButton}
|
|
86
|
+
>
|
|
87
|
+
<IconChevronLeft className="cleen-size-4 cleen-text-gray/30" />
|
|
88
|
+
{menuStack?.[menuStack?.length - 1]?.title}
|
|
89
|
+
</button>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
{activeItems?.map((item, idx, arr) => (
|
|
93
|
+
<MenuItem
|
|
94
|
+
key={item?.id || idx}
|
|
95
|
+
item={item}
|
|
96
|
+
isLast={idx === arr?.length - 1}
|
|
97
|
+
handleClick={handleItemClick}
|
|
98
|
+
onEnterSubmenu={enterSubmenu}
|
|
99
|
+
classNames={classNames?.item}
|
|
100
|
+
styles={styles?.item}
|
|
101
|
+
/>
|
|
102
|
+
))}
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { IconChevronRight } from '@/components/cleenIcon';
|
|
2
|
+
import { cn } from '@cleen/ui-core';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import type {
|
|
5
|
+
MenuItemButton,
|
|
6
|
+
MenuItemLink,
|
|
7
|
+
MenuItemProps,
|
|
8
|
+
} from '../types/menuItem';
|
|
9
|
+
|
|
10
|
+
const getWrapperProps = ({
|
|
11
|
+
item,
|
|
12
|
+
classNames,
|
|
13
|
+
styles,
|
|
14
|
+
}: {
|
|
15
|
+
item: MenuItemButton | MenuItemLink;
|
|
16
|
+
handleClick?: MenuItemProps['handleClick'];
|
|
17
|
+
classNames?: MenuItemProps['classNames'];
|
|
18
|
+
styles?: MenuItemProps['styles'];
|
|
19
|
+
}) => ({
|
|
20
|
+
disabled: item?.disabled,
|
|
21
|
+
className: cn(
|
|
22
|
+
'cleen-flex cleen-items-center cleen-gap-3 cleen-px-4 cleen-py-2 cleen-w-full cleen-text-gray cleen-text-sm cleen-text-left cleen-transition-colors',
|
|
23
|
+
item?.disabled
|
|
24
|
+
? 'cleen-opacity-50 cleen-select-none cleen-cursor-not-allowed'
|
|
25
|
+
: 'hover:cleen-bg-gray/5 cleen-cursor-pointer',
|
|
26
|
+
{
|
|
27
|
+
'cleen-text-error hover:cleen-bg-error/10': item?.danger,
|
|
28
|
+
},
|
|
29
|
+
classNames?.container
|
|
30
|
+
),
|
|
31
|
+
style: styles?.container,
|
|
32
|
+
children: (
|
|
33
|
+
<>
|
|
34
|
+
{item?.icon}
|
|
35
|
+
|
|
36
|
+
<span
|
|
37
|
+
className={cn('cleen-flex-1', classNames?.label)}
|
|
38
|
+
style={styles?.label}
|
|
39
|
+
>
|
|
40
|
+
{item?.label}
|
|
41
|
+
</span>
|
|
42
|
+
</>
|
|
43
|
+
),
|
|
44
|
+
...(item?.type === 'button' ? { type: 'button' as const } : { to: item?.to }),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const MenuItem = ({
|
|
48
|
+
item,
|
|
49
|
+
isLast,
|
|
50
|
+
handleClick,
|
|
51
|
+
onEnterSubmenu,
|
|
52
|
+
classNames,
|
|
53
|
+
styles,
|
|
54
|
+
}: MenuItemProps) => {
|
|
55
|
+
switch (item?.type) {
|
|
56
|
+
case 'group':
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
{item?.label && (
|
|
60
|
+
<p
|
|
61
|
+
className={cn(
|
|
62
|
+
'cleen-px-4 cleen-py-2 cleen-font-bold cleen-text-gray/60 cleen-text-xs',
|
|
63
|
+
classNames?.groupLabel
|
|
64
|
+
)}
|
|
65
|
+
style={styles?.groupDivider}
|
|
66
|
+
>
|
|
67
|
+
{item?.label}
|
|
68
|
+
</p>
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
{item?.items?.map((i, idx, arr) => (
|
|
72
|
+
<MenuItem
|
|
73
|
+
key={i?.id || idx}
|
|
74
|
+
item={i}
|
|
75
|
+
handleClick={handleClick}
|
|
76
|
+
onEnterSubmenu={onEnterSubmenu}
|
|
77
|
+
isLast={idx === arr.length - 1}
|
|
78
|
+
/>
|
|
79
|
+
))}
|
|
80
|
+
|
|
81
|
+
{!isLast && (
|
|
82
|
+
<hr
|
|
83
|
+
className={cn('cleen-text-gray/20', classNames?.groupDivider)}
|
|
84
|
+
style={styles?.groupDivider}
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
case 'button': {
|
|
91
|
+
const hasSubmenu = item?.submenu && item?.submenu?.length > 0;
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
onClick={() => {
|
|
97
|
+
if (hasSubmenu) {
|
|
98
|
+
onEnterSubmenu?.(item.submenu!, item?.label);
|
|
99
|
+
} else {
|
|
100
|
+
handleClick?.(item);
|
|
101
|
+
}
|
|
102
|
+
}}
|
|
103
|
+
{...getWrapperProps({ item, classNames, styles })}
|
|
104
|
+
>
|
|
105
|
+
{item?.icon}
|
|
106
|
+
<span className="cleen-flex-1">{item?.label}</span>
|
|
107
|
+
{hasSubmenu && (
|
|
108
|
+
<IconChevronRight className="cleen-size-4 cleen-text-gray/50" />
|
|
109
|
+
)}
|
|
110
|
+
</button>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
case 'link':
|
|
115
|
+
return <Link to="" {...getWrapperProps({ item, classNames, styles })} />;
|
|
116
|
+
|
|
117
|
+
default:
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Position } from '@cleen/ui-core';
|
|
2
|
+
import type { ComponentProps, CSSProperties } from 'react';
|
|
3
|
+
import type { IMenuItem, MenuItemProps } from './menuItem';
|
|
4
|
+
|
|
5
|
+
export type MenuProps = ComponentProps<'div'> & {
|
|
6
|
+
items?: IMenuItem[];
|
|
7
|
+
position?: Position;
|
|
8
|
+
keepOpenOnClick?: boolean;
|
|
9
|
+
classNames?: {
|
|
10
|
+
container?: string;
|
|
11
|
+
trigger?: string;
|
|
12
|
+
triggerOpen?: string;
|
|
13
|
+
menu?: string;
|
|
14
|
+
item?: MenuItemProps['classNames'];
|
|
15
|
+
submenuButton?: string;
|
|
16
|
+
};
|
|
17
|
+
styles?: {
|
|
18
|
+
container?: CSSProperties;
|
|
19
|
+
trigger?: CSSProperties;
|
|
20
|
+
triggerOpen?: CSSProperties;
|
|
21
|
+
menu?: CSSProperties;
|
|
22
|
+
item?: MenuItemProps['styles'];
|
|
23
|
+
submenuButton?: CSSProperties;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export interface MenuStack {
|
|
28
|
+
items: IMenuItem[];
|
|
29
|
+
title?: React.ReactNode;
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface MenuItemProps {
|
|
4
|
+
item: IMenuItem;
|
|
5
|
+
isLast?: boolean;
|
|
6
|
+
handleClick?: (item: MenuItemButton) => void;
|
|
7
|
+
onEnterSubmenu?: (items: IMenuItem[], title?: React.ReactNode) => void;
|
|
8
|
+
classNames?: {
|
|
9
|
+
container?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
groupLabel?: string;
|
|
12
|
+
groupDivider?: string;
|
|
13
|
+
};
|
|
14
|
+
styles?: {
|
|
15
|
+
container?: CSSProperties;
|
|
16
|
+
label?: CSSProperties;
|
|
17
|
+
groupLabel?: CSSProperties;
|
|
18
|
+
groupDivider?: CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type IMenuItem = MenuItemButton | MenuItemLink | MenuItemGroup;
|
|
23
|
+
|
|
24
|
+
interface MenuItemSharedProps {
|
|
25
|
+
id?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
danger?: boolean;
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
label?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MenuItemButton extends MenuItemSharedProps {
|
|
33
|
+
type: 'button';
|
|
34
|
+
onClick?: () => void;
|
|
35
|
+
submenu?: IMenuItem[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface MenuItemLink extends MenuItemSharedProps {
|
|
39
|
+
type: 'link';
|
|
40
|
+
to: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface MenuItemGroup {
|
|
44
|
+
id?: string;
|
|
45
|
+
type: 'group';
|
|
46
|
+
label?: ReactNode;
|
|
47
|
+
items: IMenuItem[];
|
|
48
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Button } from '@/components/button';
|
|
2
|
+
import { Card } from '@/components/card';
|
|
3
|
+
import type { CardProps } from '@/components/card/Card';
|
|
4
|
+
import { IconX } from '@/components/cleenIcon';
|
|
5
|
+
import {
|
|
6
|
+
cn,
|
|
7
|
+
type ComponentClassnames,
|
|
8
|
+
type ComponentStyles,
|
|
9
|
+
} from '@cleen/ui-core';
|
|
10
|
+
import {
|
|
11
|
+
forwardRef,
|
|
12
|
+
useEffect,
|
|
13
|
+
useRef,
|
|
14
|
+
useState,
|
|
15
|
+
type ComponentProps,
|
|
16
|
+
type CSSProperties,
|
|
17
|
+
type ReactNode,
|
|
18
|
+
} from 'react';
|
|
19
|
+
import { createPortal } from 'react-dom';
|
|
20
|
+
|
|
21
|
+
const SIZES = {
|
|
22
|
+
xs: 320,
|
|
23
|
+
sm: 384,
|
|
24
|
+
md: 448,
|
|
25
|
+
lg: 512,
|
|
26
|
+
xl: 576,
|
|
27
|
+
'2xl': 728,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const TRANSITION_DURATION = 300;
|
|
31
|
+
|
|
32
|
+
export type ModalProps = ComponentProps<'div'> & {
|
|
33
|
+
isOpen?: boolean;
|
|
34
|
+
onClose?: () => void;
|
|
35
|
+
closeOnOverlayClick?: boolean;
|
|
36
|
+
closeButtonIcon?: ReactNode | null;
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
size?: keyof typeof SIZES | number;
|
|
39
|
+
header?: CardProps['header'];
|
|
40
|
+
footer?: CardProps['header'];
|
|
41
|
+
color?: string;
|
|
42
|
+
p?: number;
|
|
43
|
+
gap?: number;
|
|
44
|
+
classNames?: {
|
|
45
|
+
overlay?: string;
|
|
46
|
+
container?: string;
|
|
47
|
+
modal?: ComponentClassnames<CardProps>;
|
|
48
|
+
};
|
|
49
|
+
styles?: {
|
|
50
|
+
overlay?: CSSProperties;
|
|
51
|
+
container?: CSSProperties;
|
|
52
|
+
modal?: ComponentStyles<CardProps>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Modal component that displays content in a centered modal dialog.
|
|
58
|
+
*
|
|
59
|
+
* - Controlled via `isOpen` (boolean) and `onClose` (callback).
|
|
60
|
+
* - Renders a clickable overlay/backdrop that closes the modal when clicked.
|
|
61
|
+
* - Modal content is centered on the screen with smooth fade-in/fade-out animations.
|
|
62
|
+
* - Accepts `classNames` and `styles` objects to customize classes and inline styles for:
|
|
63
|
+
* `overlay` and `container`.
|
|
64
|
+
*/
|
|
65
|
+
export const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(
|
|
66
|
+
{
|
|
67
|
+
isOpen = false,
|
|
68
|
+
onClose,
|
|
69
|
+
closeOnOverlayClick = true,
|
|
70
|
+
closeButtonIcon = <IconX className="cleen-size-5" />,
|
|
71
|
+
header,
|
|
72
|
+
footer,
|
|
73
|
+
zIndex = 50,
|
|
74
|
+
size = 'md',
|
|
75
|
+
color,
|
|
76
|
+
p,
|
|
77
|
+
gap,
|
|
78
|
+
className,
|
|
79
|
+
classNames,
|
|
80
|
+
style,
|
|
81
|
+
styles,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
},
|
|
85
|
+
ref
|
|
86
|
+
) {
|
|
87
|
+
const [isVisible, setIsVisible] = useState(isOpen);
|
|
88
|
+
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
89
|
+
const internalRef = useRef<HTMLDivElement>(null);
|
|
90
|
+
|
|
91
|
+
const closeModal = () => {
|
|
92
|
+
setIsVisible(false);
|
|
93
|
+
setTimeout(() => onClose?.(), TRANSITION_DURATION);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (isOpen) {
|
|
98
|
+
setShouldRender(true);
|
|
99
|
+
const timer = setTimeout(() => setIsVisible(true), 1);
|
|
100
|
+
return () => clearTimeout(timer);
|
|
101
|
+
} else {
|
|
102
|
+
setIsVisible(false);
|
|
103
|
+
const timer = setTimeout(
|
|
104
|
+
() => setShouldRender(false),
|
|
105
|
+
TRANSITION_DURATION
|
|
106
|
+
);
|
|
107
|
+
return () => clearTimeout(timer);
|
|
108
|
+
}
|
|
109
|
+
}, [isOpen]);
|
|
110
|
+
|
|
111
|
+
if (!shouldRender) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return createPortal(
|
|
116
|
+
<div className={cn('cleen', className)} style={style} ref={ref} {...props}>
|
|
117
|
+
{/* Overlay */}
|
|
118
|
+
<div
|
|
119
|
+
className={cn(
|
|
120
|
+
'cleen-fixed cleen-inset-0 cleen-bg-black/50 dark:cleen-bg-white/50 cleen-transition-opacity cleen-duration-300 cleen-ease-in-out',
|
|
121
|
+
isVisible ? 'cleen-opacity-100' : 'cleen-opacity-0',
|
|
122
|
+
classNames?.overlay
|
|
123
|
+
)}
|
|
124
|
+
style={{
|
|
125
|
+
zIndex,
|
|
126
|
+
...styles?.overlay,
|
|
127
|
+
}}
|
|
128
|
+
onClick={() => {
|
|
129
|
+
if (closeOnOverlayClick) {
|
|
130
|
+
closeModal();
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
aria-hidden="true"
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
{/* Modal Container */}
|
|
137
|
+
<div
|
|
138
|
+
className={cn(
|
|
139
|
+
'cleen-fixed cleen-inset-0 cleen-flex cleen-justify-center cleen-items-center cleen-p-4 cleen-overflow-auto',
|
|
140
|
+
'cleen-transition-all cleen-duration-300 cleen-ease-in-out',
|
|
141
|
+
'cleen-pointer-events-none',
|
|
142
|
+
isVisible
|
|
143
|
+
? 'cleen-opacity-100 cleen-scale-100'
|
|
144
|
+
: 'cleen-opacity-0 cleen-scale-95',
|
|
145
|
+
classNames?.container
|
|
146
|
+
)}
|
|
147
|
+
style={{ zIndex, ...styles?.container }}
|
|
148
|
+
aria-modal="true"
|
|
149
|
+
role="dialog"
|
|
150
|
+
>
|
|
151
|
+
<Card
|
|
152
|
+
header={header}
|
|
153
|
+
footer={footer}
|
|
154
|
+
color={color}
|
|
155
|
+
p={p}
|
|
156
|
+
gap={gap}
|
|
157
|
+
className={cn(
|
|
158
|
+
'cleen-relative cleen-shadow-xl cleen-w-full cleen-max-w-lg cleen-max-h-[90vh] cleen-rounded-lg',
|
|
159
|
+
'cleen-pointer-events-auto',
|
|
160
|
+
classNames?.modal?.className
|
|
161
|
+
)}
|
|
162
|
+
style={{
|
|
163
|
+
maxWidth: typeof size === 'number' ? size : SIZES[size],
|
|
164
|
+
...styles?.modal?.style,
|
|
165
|
+
}}
|
|
166
|
+
classNames={classNames?.modal?.classNames}
|
|
167
|
+
styles={styles?.modal?.styles}
|
|
168
|
+
ref={internalRef}
|
|
169
|
+
>
|
|
170
|
+
{children}
|
|
171
|
+
|
|
172
|
+
{closeButtonIcon && (
|
|
173
|
+
<div className={cn('cleen-top-3 cleen-right-3 cleen-absolute')}>
|
|
174
|
+
<Button
|
|
175
|
+
variant="borderless"
|
|
176
|
+
onClick={closeModal}
|
|
177
|
+
aria-label="Close modal"
|
|
178
|
+
classNames={{
|
|
179
|
+
container: 'cleen-p-1.5 cleen-rounded-full',
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
{closeButtonIcon}
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
)}
|
|
186
|
+
</Card>
|
|
187
|
+
</div>
|
|
188
|
+
</div>,
|
|
189
|
+
document.body
|
|
190
|
+
);
|
|
191
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Modal, type ModalProps } from './Modal';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { NOTIFICATION_VARIANT_CONFIG } from '@/components/notification/constant/notification';
|
|
2
|
+
import { cn } from '@cleen/ui-core';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
Bounce,
|
|
6
|
+
Flip,
|
|
7
|
+
toast as notification,
|
|
8
|
+
Slide,
|
|
9
|
+
Zoom,
|
|
10
|
+
type ToastOptions as NotificationOptions,
|
|
11
|
+
} from 'react-toastify';
|
|
12
|
+
|
|
13
|
+
export type NotificationVariant =
|
|
14
|
+
| 'success'
|
|
15
|
+
| 'error'
|
|
16
|
+
| 'info'
|
|
17
|
+
| 'warning'
|
|
18
|
+
| 'default';
|
|
19
|
+
|
|
20
|
+
export interface NotificationProps extends Omit<
|
|
21
|
+
NotificationOptions,
|
|
22
|
+
'type' | 'transition'
|
|
23
|
+
> {
|
|
24
|
+
message: ReactNode;
|
|
25
|
+
variant?: NotificationVariant;
|
|
26
|
+
animationType?: 'bounce' | 'zoom' | 'slide' | 'flip';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The `Notification` component provides a way to display brief notifications to users.
|
|
31
|
+
* It uses react-toastify library for toast notifications.
|
|
32
|
+
*/
|
|
33
|
+
export const showNotification = ({
|
|
34
|
+
message,
|
|
35
|
+
variant = 'default',
|
|
36
|
+
animationType = 'slide',
|
|
37
|
+
className,
|
|
38
|
+
...options
|
|
39
|
+
}: NotificationProps) => {
|
|
40
|
+
const getAnimationType = () => {
|
|
41
|
+
switch (animationType) {
|
|
42
|
+
case 'bounce':
|
|
43
|
+
return Bounce;
|
|
44
|
+
|
|
45
|
+
case 'flip':
|
|
46
|
+
return Flip;
|
|
47
|
+
|
|
48
|
+
case 'zoom':
|
|
49
|
+
return Zoom;
|
|
50
|
+
|
|
51
|
+
case 'slide':
|
|
52
|
+
default:
|
|
53
|
+
return Slide;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const notificationOptions: NotificationOptions = {
|
|
58
|
+
...NOTIFICATION_VARIANT_CONFIG.default,
|
|
59
|
+
...(variant !== 'default' && NOTIFICATION_VARIANT_CONFIG[variant]),
|
|
60
|
+
transition: getAnimationType(),
|
|
61
|
+
className: cn('cleen-text-sm', className),
|
|
62
|
+
...options,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
switch (variant) {
|
|
66
|
+
case 'success':
|
|
67
|
+
return notification.success(message, notificationOptions);
|
|
68
|
+
case 'error':
|
|
69
|
+
return notification.error(message, notificationOptions);
|
|
70
|
+
case 'info':
|
|
71
|
+
return notification.info(message, notificationOptions);
|
|
72
|
+
case 'warning':
|
|
73
|
+
return notification.warning(message, notificationOptions);
|
|
74
|
+
|
|
75
|
+
case 'default':
|
|
76
|
+
default:
|
|
77
|
+
return notification(message, notificationOptions);
|
|
78
|
+
}
|
|
79
|
+
};
|