@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,69 @@
|
|
|
1
|
+
import type { TooltipProps } from '@/components/tooltip/Tooltip';
|
|
2
|
+
import type { ComponentProps, CSSProperties, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface Bar {
|
|
5
|
+
// Type indicating serie as a bar
|
|
6
|
+
type: 'bar';
|
|
7
|
+
|
|
8
|
+
// Range start (0-100). If omitted for a range, defaults to 0.
|
|
9
|
+
start?: number;
|
|
10
|
+
// Range end (0-100). If omitted for a range, defaults to 100.
|
|
11
|
+
end?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Clamp {
|
|
15
|
+
// Type indicating serie as a clamp
|
|
16
|
+
type: 'clamp';
|
|
17
|
+
|
|
18
|
+
// Position for clamp markers (0-100). Optional if `start` is provided.
|
|
19
|
+
value?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Serie = (Bar | Clamp) & {
|
|
23
|
+
// Color for the serie. Any valid CSS color.
|
|
24
|
+
color?: string;
|
|
25
|
+
|
|
26
|
+
// Height of the series in px
|
|
27
|
+
height?: number;
|
|
28
|
+
|
|
29
|
+
// Optional label underneath the serie
|
|
30
|
+
label?: ReactNode;
|
|
31
|
+
|
|
32
|
+
// Optional tooltip upon hovering over the serie
|
|
33
|
+
tooltip?: TooltipProps;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export interface AdvancedProgressBarProps extends ComponentProps<'div'> {
|
|
37
|
+
// Array of series to render on the track.
|
|
38
|
+
series?: Serie[];
|
|
39
|
+
// Optional CSS class overrides
|
|
40
|
+
classNames?: {
|
|
41
|
+
container?: string;
|
|
42
|
+
track?: string;
|
|
43
|
+
bar?: string; // for range bars
|
|
44
|
+
clamp?: string; // for clamp markers
|
|
45
|
+
labels?: string;
|
|
46
|
+
label?: string;
|
|
47
|
+
};
|
|
48
|
+
// Optional inline style overrides
|
|
49
|
+
styles?: {
|
|
50
|
+
container?: CSSProperties;
|
|
51
|
+
track?: CSSProperties;
|
|
52
|
+
bar?: CSSProperties;
|
|
53
|
+
clamp?: CSSProperties;
|
|
54
|
+
label?: CSSProperties;
|
|
55
|
+
labels?: CSSProperties;
|
|
56
|
+
};
|
|
57
|
+
track?: {
|
|
58
|
+
// Track background color
|
|
59
|
+
color?: string;
|
|
60
|
+
// Height of the track in px (visual), defaults to 8
|
|
61
|
+
height?: number;
|
|
62
|
+
};
|
|
63
|
+
// Minimum value for the scale (defaults to 0)
|
|
64
|
+
minValue?: number;
|
|
65
|
+
// Maximum value for the scale (defaults to 100)
|
|
66
|
+
maxValue?: number;
|
|
67
|
+
renderAnimated?: boolean;
|
|
68
|
+
renderAnimatedDuration?: number;
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const clamp = (v: number) =>
|
|
2
|
+
Math.max(0, Math.min(100, Number.isFinite(v) ? v : 0));
|
|
3
|
+
|
|
4
|
+
export const valueToPercent = (
|
|
5
|
+
value: number,
|
|
6
|
+
minValue: number,
|
|
7
|
+
maxValue: number
|
|
8
|
+
) => {
|
|
9
|
+
const min = Number.isFinite(minValue) ? minValue : 0;
|
|
10
|
+
const max = Number.isFinite(maxValue) ? maxValue : 100;
|
|
11
|
+
|
|
12
|
+
if (max === min) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return ((value - min) / (max - min)) * 100;
|
|
17
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Button } from '@/components/button';
|
|
2
|
+
import type { ButtonProps } from '@/components/button/Button';
|
|
3
|
+
import {
|
|
4
|
+
cn,
|
|
5
|
+
ColorHelpers,
|
|
6
|
+
formatAudioTime,
|
|
7
|
+
type ComponentClassnames,
|
|
8
|
+
type ComponentStyles,
|
|
9
|
+
} from '@cleen/ui-core';
|
|
10
|
+
import { useWavesurfer } from '@wavesurfer/react';
|
|
11
|
+
import {
|
|
12
|
+
forwardRef,
|
|
13
|
+
useCallback,
|
|
14
|
+
useRef,
|
|
15
|
+
type CSSProperties,
|
|
16
|
+
type ComponentProps,
|
|
17
|
+
} from 'react';
|
|
18
|
+
import { FaPause, FaPlay } from 'react-icons/fa';
|
|
19
|
+
import type { WaveSurferOptions } from 'wavesurfer.js';
|
|
20
|
+
|
|
21
|
+
type WaveSurferHookOptions = Omit<WaveSurferOptions, 'container' | 'url'>;
|
|
22
|
+
|
|
23
|
+
const DEFAULT_OPTIONS: WaveSurferHookOptions = {
|
|
24
|
+
waveColor: ColorHelpers.getComputedColor('var(--cleen-light-gray)'),
|
|
25
|
+
progressColor: ColorHelpers.getComputedColor('var(--cleen-primary)'),
|
|
26
|
+
cursorColor: 'rgb(var(--cleen-primary))',
|
|
27
|
+
height: 56,
|
|
28
|
+
barWidth: 2,
|
|
29
|
+
barGap: 2,
|
|
30
|
+
barRadius: 2,
|
|
31
|
+
interact: true,
|
|
32
|
+
normalize: true,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface AudioPlaybackProps extends Omit<
|
|
36
|
+
ComponentProps<'div'>,
|
|
37
|
+
'children'
|
|
38
|
+
> {
|
|
39
|
+
/** URL of the audio file to play */
|
|
40
|
+
url: string;
|
|
41
|
+
options?: WaveSurferHookOptions;
|
|
42
|
+
classNames?: {
|
|
43
|
+
container?: string;
|
|
44
|
+
controls?: string;
|
|
45
|
+
playButton?: ComponentClassnames<ButtonProps>;
|
|
46
|
+
waveform?: string;
|
|
47
|
+
timestamp?: string;
|
|
48
|
+
};
|
|
49
|
+
styles?: {
|
|
50
|
+
container?: CSSProperties;
|
|
51
|
+
controls?: CSSProperties;
|
|
52
|
+
playButton?: ComponentStyles<ButtonProps>;
|
|
53
|
+
waveform?: CSSProperties;
|
|
54
|
+
timestamp?: CSSProperties;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The `AudioPlayback` component renders an interactive audio player with a waveform
|
|
60
|
+
* visualization, a play/pause control, and a current/total time display.
|
|
61
|
+
*
|
|
62
|
+
* - Provide a `url` pointing to the audio file.
|
|
63
|
+
* - Use `waveColor` / `progressColor` to theme the waveform.
|
|
64
|
+
* - Accepts `classNames` and `styles` to customize: `container`, `controls`, `playButton`, `waveform`, `timestamp`.
|
|
65
|
+
*/
|
|
66
|
+
export const AudioPlayback = forwardRef<HTMLDivElement, AudioPlaybackProps>(
|
|
67
|
+
function AudioPlayback(
|
|
68
|
+
{ url, options, className, classNames, style, styles, ...props },
|
|
69
|
+
ref
|
|
70
|
+
) {
|
|
71
|
+
const waveformRef = useRef<HTMLDivElement>(null);
|
|
72
|
+
|
|
73
|
+
const { wavesurfer, isPlaying, isReady, currentTime } = useWavesurfer({
|
|
74
|
+
...DEFAULT_OPTIONS,
|
|
75
|
+
...options,
|
|
76
|
+
container: waveformRef,
|
|
77
|
+
url,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const totalDuration = isReady ? (wavesurfer?.getDuration() ?? 0) : 0;
|
|
81
|
+
|
|
82
|
+
const handlePlayPause = useCallback(() => {
|
|
83
|
+
wavesurfer?.playPause();
|
|
84
|
+
}, [wavesurfer]);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn('cleen', className)}
|
|
90
|
+
style={style}
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
className={cn(
|
|
95
|
+
'cleen-flex cleen-items-center cleen-gap-3 cleen-px-4 cleen-py-3 cleen-rounded-xl cleen-bg-white cleen-border cleen-border-gray/10',
|
|
96
|
+
classNames?.container
|
|
97
|
+
)}
|
|
98
|
+
style={styles?.container}
|
|
99
|
+
>
|
|
100
|
+
{/* play/pause controls */}
|
|
101
|
+
<Button
|
|
102
|
+
type="button"
|
|
103
|
+
onClick={handlePlayPause}
|
|
104
|
+
disabled={!isReady}
|
|
105
|
+
aria-label={isPlaying ? 'Pause' : 'Play'}
|
|
106
|
+
className={classNames?.playButton?.className}
|
|
107
|
+
classNames={{
|
|
108
|
+
...classNames?.playButton?.classNames,
|
|
109
|
+
container: cn(
|
|
110
|
+
'cleen-p-0 !cleen-size-9 cleen-rounded-full',
|
|
111
|
+
classNames?.playButton?.classNames?.container
|
|
112
|
+
),
|
|
113
|
+
}}
|
|
114
|
+
{...styles?.playButton}
|
|
115
|
+
>
|
|
116
|
+
{isPlaying ? <FaPause /> : <FaPlay />}
|
|
117
|
+
</Button>
|
|
118
|
+
|
|
119
|
+
{/* waveform */}
|
|
120
|
+
<div
|
|
121
|
+
ref={waveformRef}
|
|
122
|
+
className={cn('cleen-flex-1 cleen-min-w-0', classNames?.waveform)}
|
|
123
|
+
style={styles?.waveform}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
{/* timestamp: current / total */}
|
|
127
|
+
<span
|
|
128
|
+
className={cn(
|
|
129
|
+
'cleen-shrink-0 cleen-text-xs cleen-text-gray/60 cleen-tabular-nums',
|
|
130
|
+
classNames?.timestamp
|
|
131
|
+
)}
|
|
132
|
+
style={styles?.timestamp}
|
|
133
|
+
>
|
|
134
|
+
{formatAudioTime(currentTime)} /
|
|
135
|
+
{formatAudioTime(totalDuration)}
|
|
136
|
+
</span>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_AUDIO_RECORDER_OPTIONS,
|
|
3
|
+
DEFAULT_REGION_COLOR,
|
|
4
|
+
} from '@/components/audioRecorder/constant/default';
|
|
5
|
+
import { DEFAULT_AUDIO_RECORDER_LABELS } from '@/components/audioRecorder/constant/labels';
|
|
6
|
+
import type { AudioRecorderProps } from '@/components/audioRecorder/types/props';
|
|
7
|
+
import { Button } from '@/components/button';
|
|
8
|
+
import { IconCheck } from '@/components/cleenIcon';
|
|
9
|
+
import { cn, formatAudioTime, trimBlob } from '@cleen/ui-core';
|
|
10
|
+
import { useWavesurfer } from '@wavesurfer/react';
|
|
11
|
+
import {
|
|
12
|
+
forwardRef,
|
|
13
|
+
useCallback,
|
|
14
|
+
useEffect,
|
|
15
|
+
useMemo,
|
|
16
|
+
useRef,
|
|
17
|
+
useState,
|
|
18
|
+
} from 'react';
|
|
19
|
+
import { BiMicrophone } from 'react-icons/bi';
|
|
20
|
+
import { BsStop } from 'react-icons/bs';
|
|
21
|
+
import { FaPause, FaPlay, FaScissors, FaTrash } from 'react-icons/fa6';
|
|
22
|
+
import RecordPlugin from 'wavesurfer.js/dist/plugins/record.js';
|
|
23
|
+
import RegionsPlugin, {
|
|
24
|
+
type Region,
|
|
25
|
+
} from 'wavesurfer.js/dist/plugins/regions.js';
|
|
26
|
+
|
|
27
|
+
type RecorderStatus = 'idle' | 'recording' | 'recorded';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `AudioRecorder` captures audio from the microphone with a live waveform preview.
|
|
31
|
+
* After stopping, a resizable trim region appears — drag its handles to select the
|
|
32
|
+
* desired clip, then hit the scissors button to apply. The trash button discards
|
|
33
|
+
* the whole recording.
|
|
34
|
+
*
|
|
35
|
+
* - `onFinalize(blob, url)` fires when the user confirms the final recording.
|
|
36
|
+
* - `recordOptions` are forwarded directly to the WaveSurfer `RecordPlugin`.
|
|
37
|
+
* - `options` controls the WaveSurfer instance (waveColor, height, regionColor, etc.).
|
|
38
|
+
* - `labels` allows overriding UI strings (e.g. `startRecording`).
|
|
39
|
+
* - Accepts `classNames` / `styles` for: `container`, `startButton`, `startLabel`,
|
|
40
|
+
* `stopButton`, `waveform`, `recordedContainer`, `timestamp`, `trimmedTimestamp`,
|
|
41
|
+
* `playPauseButton`, `discardButton`, `trimButton`, `finalizeButton`.
|
|
42
|
+
*/
|
|
43
|
+
export const AudioRecorder = forwardRef<HTMLDivElement, AudioRecorderProps>(
|
|
44
|
+
function AudioRecorder(
|
|
45
|
+
{
|
|
46
|
+
onFinalize,
|
|
47
|
+
recordOptions,
|
|
48
|
+
options,
|
|
49
|
+
labels = DEFAULT_AUDIO_RECORDER_LABELS,
|
|
50
|
+
className,
|
|
51
|
+
classNames,
|
|
52
|
+
style,
|
|
53
|
+
styles,
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
56
|
+
ref
|
|
57
|
+
) {
|
|
58
|
+
const waveformRef = useRef<HTMLDivElement>(null);
|
|
59
|
+
|
|
60
|
+
const [status, setStatus] = useState<RecorderStatus>('idle');
|
|
61
|
+
const [recordedBlob, setRecordedBlob] = useState<Blob | null>(null);
|
|
62
|
+
const [trimRegion, setTrimRegion] = useState<{
|
|
63
|
+
start: number;
|
|
64
|
+
end: number;
|
|
65
|
+
} | null>(null);
|
|
66
|
+
const [isTrimming, setIsTrimming] = useState(false);
|
|
67
|
+
|
|
68
|
+
// Lets wavesurfer callbacks read the latest status without going stale in a closure
|
|
69
|
+
const statusRef = useRef<RecorderStatus>('idle');
|
|
70
|
+
statusRef.current = status;
|
|
71
|
+
|
|
72
|
+
// Stable plugin instances – reinitialising mid-lifecycle would nuke wavesurfer (¬_¬)
|
|
73
|
+
const plugins = useMemo(
|
|
74
|
+
() =>
|
|
75
|
+
[
|
|
76
|
+
RecordPlugin.create({
|
|
77
|
+
renderRecordedAudio: true,
|
|
78
|
+
scrollingWaveform: false,
|
|
79
|
+
continuousWaveform: false,
|
|
80
|
+
...recordOptions,
|
|
81
|
+
}),
|
|
82
|
+
RegionsPlugin.create(),
|
|
83
|
+
] as [RecordPlugin, RegionsPlugin],
|
|
84
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
+
[]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const [recordPlugin, regionPlugin] = plugins;
|
|
89
|
+
|
|
90
|
+
const { wavesurfer, isPlaying, isReady, currentTime } = useWavesurfer({
|
|
91
|
+
...DEFAULT_AUDIO_RECORDER_OPTIONS,
|
|
92
|
+
...options,
|
|
93
|
+
container: waveformRef,
|
|
94
|
+
plugins,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const totalDuration = isReady ? (wavesurfer?.getDuration() ?? 0) : 0;
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const unsubs = [
|
|
101
|
+
recordPlugin.on('record-start', () => setStatus('recording')),
|
|
102
|
+
recordPlugin.on('record-end', (blob: Blob) => {
|
|
103
|
+
setStatus('recorded');
|
|
104
|
+
setRecordedBlob(blob);
|
|
105
|
+
}),
|
|
106
|
+
regionPlugin.on('region-clicked', (region, e) => {
|
|
107
|
+
e.stopPropagation(); // prevent triggering a click on the waveform
|
|
108
|
+
region.play(true);
|
|
109
|
+
}),
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
return () => unsubs.forEach(fn => fn?.());
|
|
113
|
+
}, [regionPlugin, recordPlugin]);
|
|
114
|
+
|
|
115
|
+
// ── Add a full-span resizable region whenever a (new) audio finishes loading ──
|
|
116
|
+
//
|
|
117
|
+
// renderRecordedAudio causes wavesurfer to call load() internally after record-end,
|
|
118
|
+
// so 'ready' fires once the waveform is drawn. Same thing happens after a trim reload.
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (!wavesurfer) return;
|
|
122
|
+
|
|
123
|
+
const unsub = wavesurfer.on('ready', () => {
|
|
124
|
+
if (statusRef.current !== 'recorded') return;
|
|
125
|
+
|
|
126
|
+
const duration = wavesurfer.getDuration();
|
|
127
|
+
regionPlugin.clearRegions();
|
|
128
|
+
|
|
129
|
+
const region: Region = regionPlugin.addRegion({
|
|
130
|
+
start: 0,
|
|
131
|
+
end: duration,
|
|
132
|
+
color: options?.regionColor ?? DEFAULT_REGION_COLOR,
|
|
133
|
+
drag: false,
|
|
134
|
+
resize: true,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
setTrimRegion({ start: region.start, end: region.end });
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return unsub;
|
|
141
|
+
}, [wavesurfer, regionPlugin, options]);
|
|
142
|
+
|
|
143
|
+
// Keep trim state in sync as the user drags the region handles
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
const unsub = regionPlugin.on('region-updated', (region: Region) => {
|
|
147
|
+
setTrimRegion({ start: region.start, end: region.end });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return unsub;
|
|
151
|
+
}, [regionPlugin]);
|
|
152
|
+
|
|
153
|
+
const handleStartRecording = useCallback(async () => {
|
|
154
|
+
await recordPlugin.startRecording();
|
|
155
|
+
}, [recordPlugin]);
|
|
156
|
+
|
|
157
|
+
const handleStopRecording = useCallback(() => {
|
|
158
|
+
recordPlugin.stopRecording();
|
|
159
|
+
}, [recordPlugin]);
|
|
160
|
+
|
|
161
|
+
const handlePlayPause = useCallback(() => {
|
|
162
|
+
wavesurfer?.playPause();
|
|
163
|
+
}, [wavesurfer]);
|
|
164
|
+
|
|
165
|
+
const handleTrim = useCallback(async () => {
|
|
166
|
+
if (!recordedBlob || !trimRegion || !wavesurfer) return;
|
|
167
|
+
|
|
168
|
+
setIsTrimming(true);
|
|
169
|
+
try {
|
|
170
|
+
const trimmed = await trimBlob(
|
|
171
|
+
recordedBlob,
|
|
172
|
+
trimRegion.start,
|
|
173
|
+
trimRegion.end
|
|
174
|
+
);
|
|
175
|
+
const url = URL.createObjectURL(trimmed);
|
|
176
|
+
|
|
177
|
+
setRecordedBlob(trimmed);
|
|
178
|
+
|
|
179
|
+
// Reload waveform – 'ready' will fire again and re-add a fresh full-span region
|
|
180
|
+
wavesurfer.load(url);
|
|
181
|
+
} finally {
|
|
182
|
+
setIsTrimming(false);
|
|
183
|
+
}
|
|
184
|
+
}, [recordedBlob, trimRegion, wavesurfer]);
|
|
185
|
+
|
|
186
|
+
const handleDiscard = useCallback(() => {
|
|
187
|
+
regionPlugin.clearRegions();
|
|
188
|
+
wavesurfer?.empty();
|
|
189
|
+
setRecordedBlob(null);
|
|
190
|
+
setTrimRegion(null);
|
|
191
|
+
setStatus('idle');
|
|
192
|
+
}, [wavesurfer, regionPlugin]);
|
|
193
|
+
|
|
194
|
+
const handleFinalize = useCallback(() => {
|
|
195
|
+
if (recordedBlob) {
|
|
196
|
+
const url = URL.createObjectURL(recordedBlob);
|
|
197
|
+
onFinalize?.(recordedBlob, url);
|
|
198
|
+
}
|
|
199
|
+
}, [onFinalize, recordedBlob]);
|
|
200
|
+
|
|
201
|
+
// Scissors button is disabled when the region already spans the whole clip
|
|
202
|
+
const isFullSpan =
|
|
203
|
+
!trimRegion || (trimRegion.start <= 0 && trimRegion.end >= totalDuration);
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<div
|
|
207
|
+
ref={ref}
|
|
208
|
+
className={cn('cleen wavesurfer-handle', className)}
|
|
209
|
+
style={style}
|
|
210
|
+
{...props}
|
|
211
|
+
>
|
|
212
|
+
<div
|
|
213
|
+
className={cn(
|
|
214
|
+
'cleen-flex cleen-flex-col cleen-items-center cleen-gap-3',
|
|
215
|
+
classNames?.container
|
|
216
|
+
)}
|
|
217
|
+
style={styles?.container}
|
|
218
|
+
>
|
|
219
|
+
{/* ── idle ── */}
|
|
220
|
+
{status === 'idle' && (
|
|
221
|
+
<>
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
onClick={handleStartRecording}
|
|
225
|
+
aria-label="Start recording"
|
|
226
|
+
className={cn(
|
|
227
|
+
'cleen-p-8 cleen-border-2 cleen-border-primary/20 hover:cleen-border-primary cleen-rounded-full cleen-transition-colors',
|
|
228
|
+
classNames?.startButton
|
|
229
|
+
)}
|
|
230
|
+
style={styles?.startButton}
|
|
231
|
+
>
|
|
232
|
+
<BiMicrophone className="cleen-size-8 cleen-text-primary" />
|
|
233
|
+
</button>
|
|
234
|
+
|
|
235
|
+
<p
|
|
236
|
+
className={cn(
|
|
237
|
+
'cleen-text-gray/50 cleen-text-sm cleen-select-none',
|
|
238
|
+
classNames?.startLabel
|
|
239
|
+
)}
|
|
240
|
+
style={styles?.startLabel}
|
|
241
|
+
>
|
|
242
|
+
{labels.startRecording}
|
|
243
|
+
</p>
|
|
244
|
+
</>
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
{/* ── recording ── */}
|
|
248
|
+
{status === 'recording' && (
|
|
249
|
+
<button
|
|
250
|
+
type="button"
|
|
251
|
+
onClick={handleStopRecording}
|
|
252
|
+
aria-label="Stop recording"
|
|
253
|
+
className={cn(
|
|
254
|
+
'cleen-p-8 cleen-border-2 cleen-border-primary/20 hover:cleen-border-primary cleen-rounded-full cleen-transition-colors',
|
|
255
|
+
classNames?.stopButton
|
|
256
|
+
)}
|
|
257
|
+
style={styles?.stopButton}
|
|
258
|
+
>
|
|
259
|
+
<BsStop className="cleen-size-8 cleen-text-primary" />
|
|
260
|
+
</button>
|
|
261
|
+
)}
|
|
262
|
+
|
|
263
|
+
{/* ── waveform (always mounted – wavesurfer needs a stable DOM container) ── */}
|
|
264
|
+
<div
|
|
265
|
+
ref={waveformRef}
|
|
266
|
+
className={cn(
|
|
267
|
+
'cleen-w-full cleen-min-w-0 cleen-waveform',
|
|
268
|
+
status === 'idle' && 'cleen-hidden',
|
|
269
|
+
classNames?.waveform
|
|
270
|
+
)}
|
|
271
|
+
style={styles?.waveform}
|
|
272
|
+
/>
|
|
273
|
+
|
|
274
|
+
{/* ── recorded: inline playback + trim toolbar ── */}
|
|
275
|
+
{status === 'recorded' && (
|
|
276
|
+
<div
|
|
277
|
+
className={cn(
|
|
278
|
+
'cleen-flex cleen-items-center cleen-gap-2 cleen-w-full',
|
|
279
|
+
classNames?.recordedContainer
|
|
280
|
+
)}
|
|
281
|
+
style={styles?.recordedContainer}
|
|
282
|
+
>
|
|
283
|
+
{/* Play / Pause */}
|
|
284
|
+
<Button
|
|
285
|
+
type="button"
|
|
286
|
+
onClick={handlePlayPause}
|
|
287
|
+
disabled={!isReady}
|
|
288
|
+
aria-label={isPlaying ? 'Pause' : 'Play'}
|
|
289
|
+
className={classNames?.playPauseButton?.className}
|
|
290
|
+
classNames={{
|
|
291
|
+
...classNames?.playPauseButton?.classNames,
|
|
292
|
+
container: cn(
|
|
293
|
+
'cleen-p-0 !cleen-size-9 cleen-rounded-full cleen-shrink-0',
|
|
294
|
+
classNames?.playPauseButton?.classNames?.container
|
|
295
|
+
),
|
|
296
|
+
}}
|
|
297
|
+
{...styles?.playPauseButton}
|
|
298
|
+
>
|
|
299
|
+
{isPlaying ? <FaPause /> : <FaPlay />}
|
|
300
|
+
</Button>
|
|
301
|
+
|
|
302
|
+
{/* Current / total duration */}
|
|
303
|
+
<span
|
|
304
|
+
className={cn(
|
|
305
|
+
'cleen-tabular-nums cleen-text-gray/60 cleen-text-xs cleen-shrink-0',
|
|
306
|
+
classNames?.timestamp
|
|
307
|
+
)}
|
|
308
|
+
style={styles?.timestamp}
|
|
309
|
+
>
|
|
310
|
+
{formatAudioTime(currentTime)} /
|
|
311
|
+
{formatAudioTime(totalDuration)}
|
|
312
|
+
</span>
|
|
313
|
+
|
|
314
|
+
<span className="cleen-flex-1" />
|
|
315
|
+
|
|
316
|
+
{/* Selected trim range hint – visible only when region ≠ full span */}
|
|
317
|
+
{!isFullSpan && trimRegion && (
|
|
318
|
+
<span
|
|
319
|
+
className={cn(
|
|
320
|
+
'cleen-tabular-nums cleen-text-gray/50 cleen-text-xs cleen-shrink-0',
|
|
321
|
+
classNames?.trimmedTimestamp
|
|
322
|
+
)}
|
|
323
|
+
style={styles?.trimmedTimestamp}
|
|
324
|
+
>
|
|
325
|
+
{formatAudioTime(trimRegion.start)}–
|
|
326
|
+
{formatAudioTime(trimRegion.end)}
|
|
327
|
+
</span>
|
|
328
|
+
)}
|
|
329
|
+
|
|
330
|
+
{/* Discard */}
|
|
331
|
+
<Button
|
|
332
|
+
type="button"
|
|
333
|
+
onClick={handleDiscard}
|
|
334
|
+
variant="secondary"
|
|
335
|
+
aria-label="Discard recording"
|
|
336
|
+
className={classNames?.discardButton?.className}
|
|
337
|
+
classNames={{
|
|
338
|
+
...classNames?.discardButton?.classNames,
|
|
339
|
+
container: cn(
|
|
340
|
+
'cleen-p-0 !cleen-size-9 cleen-rounded-full cleen-shrink-0',
|
|
341
|
+
classNames?.discardButton?.classNames?.container
|
|
342
|
+
),
|
|
343
|
+
}}
|
|
344
|
+
{...styles?.discardButton}
|
|
345
|
+
>
|
|
346
|
+
<FaTrash className="cleen-text-error" />
|
|
347
|
+
</Button>
|
|
348
|
+
|
|
349
|
+
{/* Apply trim */}
|
|
350
|
+
<Button
|
|
351
|
+
type="button"
|
|
352
|
+
onClick={handleTrim}
|
|
353
|
+
disabled={isFullSpan || isTrimming || !isReady}
|
|
354
|
+
aria-label="Apply trim"
|
|
355
|
+
variant="secondary"
|
|
356
|
+
className={classNames?.trimButton?.className}
|
|
357
|
+
classNames={{
|
|
358
|
+
...classNames?.trimButton?.classNames,
|
|
359
|
+
container: cn(
|
|
360
|
+
'cleen-p-0 !cleen-size-9 cleen-rounded-full cleen-shrink-0',
|
|
361
|
+
classNames?.trimButton?.classNames?.container
|
|
362
|
+
),
|
|
363
|
+
}}
|
|
364
|
+
{...styles?.trimButton}
|
|
365
|
+
>
|
|
366
|
+
<FaScissors />
|
|
367
|
+
</Button>
|
|
368
|
+
|
|
369
|
+
<Button
|
|
370
|
+
type="button"
|
|
371
|
+
onClick={handleFinalize}
|
|
372
|
+
aria-label="Finalize recording"
|
|
373
|
+
className={classNames?.finalizeButton?.className}
|
|
374
|
+
classNames={{
|
|
375
|
+
...classNames?.finalizeButton?.classNames,
|
|
376
|
+
container: cn(
|
|
377
|
+
'cleen-p-0 !cleen-size-9 cleen-rounded-full cleen-shrink-0',
|
|
378
|
+
classNames?.finalizeButton?.classNames?.container
|
|
379
|
+
),
|
|
380
|
+
}}
|
|
381
|
+
{...styles?.finalizeButton}
|
|
382
|
+
>
|
|
383
|
+
<IconCheck />
|
|
384
|
+
</Button>
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WaveSurferHookOptions } from '@/components/audioRecorder/types/props';
|
|
2
|
+
import { ColorHelpers } from '@cleen/ui-core';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_WAVE_COLOR = ColorHelpers.getComputedColor(
|
|
5
|
+
'var(--cleen-primary)'
|
|
6
|
+
);
|
|
7
|
+
export const DEFAULT_REGION_COLOR = 'rgba(var(--cleen-primary), 0.15)';
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_AUDIO_RECORDER_OPTIONS: WaveSurferHookOptions = {
|
|
10
|
+
waveColor: DEFAULT_WAVE_COLOR,
|
|
11
|
+
progressColor: DEFAULT_WAVE_COLOR,
|
|
12
|
+
cursorColor: 'rgb(var(--cleen-primary))',
|
|
13
|
+
height: 56,
|
|
14
|
+
barWidth: 2,
|
|
15
|
+
barGap: 2,
|
|
16
|
+
barRadius: 2,
|
|
17
|
+
minPxPerSec: 0.5,
|
|
18
|
+
sampleRate: 8000,
|
|
19
|
+
};
|