@flikk/ui 1.0.0-beta.2 → 1.0.0-beta.4
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/dist/components/ai/ApprovalCard/ApprovalCard.js +2 -2
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +2 -2
- package/dist/components/ai/PromptInput/PromptInput.js +51 -10
- package/dist/components/ai/PromptInput/PromptInput.theme.js +1 -0
- package/dist/components/ai/PromptInput/PromptInput.types.d.ts +20 -0
- package/dist/components/charts/DonutChart/DonutChart.types.d.ts +1 -2
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.types.d.ts +1 -2
- package/dist/components/core/Accordion/Accordion.theme.js +2 -2
- package/dist/components/core/Alert/Alert.js +2 -2
- package/dist/components/core/Alert/Alert.types.d.ts +2 -2
- package/dist/components/core/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/AlertDialog/AlertDialog.types.d.ts +2 -2
- package/dist/components/core/Badge/Badge.d.ts +1 -1
- package/dist/components/core/Badge/Badge.js +11 -9
- package/dist/components/core/Badge/Badge.theme.js +13 -14
- package/dist/components/core/Badge/Badge.types.d.ts +8 -4
- package/dist/components/core/Button/Button.d.ts +1 -1
- package/dist/components/core/Button/Button.theme.js +8 -9
- package/dist/components/core/Button/Button.types.d.ts +1 -2
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Card/Card.d.ts +2 -2
- package/dist/components/core/Card/Card.js +6 -7
- package/dist/components/core/Card/Card.theme.js +4 -4
- package/dist/components/core/Card/Card.types.d.ts +5 -20
- package/dist/components/core/Card/CardSubtitle.d.ts +3 -0
- package/dist/components/core/Card/CardSubtitle.js +11 -0
- package/dist/components/core/Card/index.d.ts +2 -2
- package/dist/components/core/CommandPalette/CommandItem.d.ts +1 -1
- package/dist/components/core/CommandPalette/CommandItem.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +2 -2
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +1 -1
- package/dist/components/core/ContextMenu/ContextMenuItem.js +2 -2
- package/dist/components/core/Drawer/Drawer.d.ts +13 -1
- package/dist/components/core/Drawer/Drawer.js +23 -10
- package/dist/components/core/Drawer/Drawer.theme.js +1 -1
- package/dist/components/core/Drawer/Drawer.types.d.ts +21 -4
- package/dist/components/core/Drawer/DrawerHeader.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerHeader.js +14 -0
- package/dist/components/core/Drawer/DrawerSubtitle.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerSubtitle.js +11 -0
- package/dist/components/core/Drawer/DrawerTitle.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerTitle.js +11 -0
- package/dist/components/core/Drawer/index.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +4 -4
- package/dist/components/core/Dropdown/DropdownItem.js +2 -2
- package/dist/components/core/Empty/Empty.js +2 -2
- package/dist/components/core/Empty/Empty.theme.d.ts +1 -1
- package/dist/components/core/Empty/Empty.theme.js +3 -3
- package/dist/components/core/Empty/Empty.types.d.ts +2 -2
- package/dist/components/core/Link/Link.d.ts +1 -1
- package/dist/components/core/Link/Link.types.d.ts +2 -2
- package/dist/components/core/MenuItem/MenuItem.js +2 -2
- package/dist/components/core/MenuItem/MenuItem.theme.d.ts +1 -2
- package/dist/components/core/MenuItem/MenuItem.theme.js +7 -9
- package/dist/components/core/MenuItem/MenuItem.types.d.ts +1 -1
- package/dist/components/core/Message/Message.d.ts +3 -2
- package/dist/components/core/Message/Message.js +30 -24
- package/dist/components/core/Message/Message.theme.d.ts +1 -1
- package/dist/components/core/Message/Message.theme.js +22 -24
- package/dist/components/core/Message/Message.types.d.ts +0 -7
- package/dist/components/core/Message/MessageList.animations.d.ts +6 -0
- package/dist/components/core/Message/MessageList.animations.js +32 -0
- package/dist/components/core/Message/MessageList.d.ts +5 -0
- package/dist/components/core/Message/MessageList.js +78 -0
- package/dist/components/core/Message/MessageList.theme.d.ts +2 -0
- package/dist/components/core/Message/MessageList.theme.js +6 -0
- package/dist/components/core/Message/MessageList.types.d.ts +32 -0
- package/dist/components/core/Message/index.d.ts +2 -0
- package/dist/components/core/Modal/Modal.d.ts +2 -2
- package/dist/components/core/Modal/Modal.js +5 -5
- package/dist/components/core/Modal/Modal.theme.js +5 -5
- package/dist/components/core/Modal/Modal.types.d.ts +4 -4
- package/dist/components/core/Modal/ModalSubtitle.d.ts +5 -0
- package/dist/components/core/Modal/ModalSubtitle.js +11 -0
- package/dist/components/core/ModalStack/ModalStack.animations.js +3 -3
- package/dist/components/core/ModalStack/ModalStackModal.js +3 -3
- package/dist/components/core/PageHeading/PageHeading.d.ts +8 -0
- package/dist/components/core/PageHeading/PageHeading.js +28 -0
- package/dist/components/core/PageHeading/PageHeading.theme.d.ts +2 -0
- package/dist/components/core/PageHeading/PageHeading.theme.js +11 -0
- package/dist/components/core/PageHeading/PageHeading.types.d.ts +55 -0
- package/dist/components/core/PageHeading/PageHeadingActions.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingActions.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingBackButton.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingBackButton.js +12 -0
- package/dist/components/core/PageHeading/PageHeadingIcon.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingIcon.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingSubtitle.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingSubtitle.js +11 -0
- package/dist/components/core/PageHeading/PageHeadingTitle.d.ts +3 -0
- package/dist/components/core/PageHeading/PageHeadingTitle.js +11 -0
- package/dist/components/core/PageHeading/index.d.ts +2 -0
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +3 -3
- package/dist/components/core/Sidebar/Sidebar.js +1 -0
- package/dist/components/core/SocialIcon/SocialIcon.d.ts +3 -0
- package/dist/components/core/SocialIcon/SocialIcon.js +30 -0
- package/dist/components/core/SocialIcon/SocialIcon.theme.d.ts +2 -0
- package/dist/components/core/SocialIcon/SocialIcon.theme.js +12 -0
- package/dist/components/core/SocialIcon/SocialIcon.types.d.ts +18 -0
- package/dist/components/core/SocialIcon/index.d.ts +2 -0
- package/dist/components/core/SocialIcon/platforms.d.ts +17 -0
- package/dist/components/core/SocialIcon/platforms.js +234 -0
- package/dist/components/core/Toast/Toast.js +4 -4
- package/dist/components/core/Toast/Toast.theme.js +1 -1
- package/dist/components/core/Toast/Toast.types.d.ts +9 -9
- package/dist/components/core/Toast/useToast.js +6 -6
- package/dist/components/core/index.d.ts +2 -7
- package/dist/components/core/index.js +9 -19
- package/dist/components/{core → data-display}/DescriptionList/DescriptionList.theme.js +1 -1
- package/dist/components/{core → data-display}/Feed/Feed.js +2 -2
- package/dist/components/data-display/GanttChart/GanttChart.animations.d.ts +4 -0
- package/dist/components/data-display/GanttChart/GanttChart.animations.js +21 -0
- package/dist/components/data-display/GanttChart/GanttChart.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttChart.js +170 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +23 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +162 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.js +9 -0
- package/dist/components/data-display/GanttChart/GanttChart.utils.d.ts +80 -0
- package/dist/components/data-display/GanttChart/GanttChart.utils.js +274 -0
- package/dist/components/data-display/GanttChart/GanttChartPanel.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttChartPanel.js +82 -0
- package/dist/components/data-display/GanttChart/GanttDependencyArrows.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttDependencyArrows.js +35 -0
- package/dist/components/data-display/GanttChart/GanttGroupBar.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttGroupBar.js +26 -0
- package/dist/components/data-display/GanttChart/GanttMilestone.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttMilestone.js +44 -0
- package/dist/components/data-display/GanttChart/GanttProgressCircle.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttProgressCircle.js +11 -0
- package/dist/components/data-display/GanttChart/GanttSplitter.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttSplitter.js +39 -0
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.d.ts +7 -0
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.js +23 -0
- package/dist/components/data-display/GanttChart/GanttTableHeader.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttTableHeader.js +13 -0
- package/dist/components/data-display/GanttChart/GanttTablePanel.d.ts +6 -0
- package/dist/components/data-display/GanttChart/GanttTablePanel.js +20 -0
- package/dist/components/data-display/GanttChart/GanttTableTaskRow.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTableTaskRow.js +30 -0
- package/dist/components/data-display/GanttChart/GanttTaskBar.d.ts +9 -0
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +206 -0
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +17 -0
- package/dist/components/data-display/GanttChart/GanttTimelineGrid.d.ts +7 -0
- package/dist/components/data-display/GanttChart/GanttTimelineGrid.js +33 -0
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.d.ts +8 -0
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +43 -0
- package/dist/components/data-display/GanttChart/GanttToolbar.d.ts +2 -0
- package/dist/components/data-display/GanttChart/GanttToolbar.js +28 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDates.d.ts +12 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDates.js +25 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDrag.d.ts +25 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttDrag.js +144 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttLayout.d.ts +2 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttLayout.js +33 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttScrollSync.d.ts +6 -0
- package/dist/components/data-display/GanttChart/hooks/useGanttScrollSync.js +32 -0
- package/dist/components/data-display/GanttChart/index.d.ts +3 -0
- package/dist/components/{core → data-display}/KPI/KPI.js +10 -8
- package/dist/components/{core → data-display}/KPI/KPI.theme.js +2 -1
- package/dist/components/{core → data-display}/KPI/KPI.types.d.ts +5 -5
- package/dist/components/{core → data-display}/KPI/index.d.ts +1 -0
- package/dist/components/{core → data-display}/Metric/Metric.js +4 -7
- package/dist/components/{core → data-display}/Metric/Metric.theme.js +9 -9
- package/dist/components/{core → data-display}/Metric/Metric.types.d.ts +6 -6
- package/dist/components/{core → data-display}/Table/Table.theme.js +2 -2
- package/dist/components/{core → data-display}/Table/TableActions.js +8 -8
- package/dist/components/{core → data-display}/Table/TableColumnManager.js +4 -4
- package/dist/components/{core → data-display}/Table/TableFilter.js +3 -3
- package/dist/components/data-display/Table/TablePagination.js +25 -0
- package/dist/components/{core → data-display}/Table/TableRow.js +1 -1
- package/dist/components/{core → data-display}/Table/TableSelectionHeader.js +1 -1
- package/dist/components/data-display/index.d.ts +7 -0
- package/dist/components/data-display/index.js +20 -0
- package/dist/components/effects/3d/index.d.ts +6 -0
- package/dist/components/effects/3d/index.js +3 -0
- package/dist/components/effects/Aurora/Aurora.d.ts +24 -0
- package/dist/components/effects/Aurora/Aurora.js +119 -0
- package/dist/components/effects/Aurora/Aurora.types.d.ts +15 -0
- package/dist/components/effects/Aurora/index.d.ts +2 -0
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +2 -2
- package/dist/components/effects/CustomCursor/CustomCursor.types.d.ts +3 -3
- package/dist/components/effects/DotPattern/DotPattern.d.ts +18 -0
- package/dist/components/effects/DotPattern/DotPattern.js +65 -0
- package/dist/components/effects/DotPattern/DotPattern.types.d.ts +47 -0
- package/dist/components/effects/DotPattern/index.d.ts +2 -0
- package/dist/components/effects/GridPattern/GridPattern.d.ts +18 -0
- package/dist/components/effects/GridPattern/GridPattern.js +64 -0
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +47 -0
- package/dist/components/effects/GridPattern/index.d.ts +2 -0
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +30 -0
- package/dist/components/effects/MagneticElement/MagneticElement.js +110 -0
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +44 -0
- package/dist/components/effects/MagneticElement/index.d.ts +2 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +17 -0
- package/dist/components/effects/MorphingText/MorphingText.js +91 -0
- package/dist/components/effects/MorphingText/MorphingText.types.d.ts +18 -0
- package/dist/components/effects/MorphingText/index.d.ts +2 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.d.ts +28 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.js +61 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.types.d.ts +35 -0
- package/dist/components/effects/NoiseOverlay/index.d.ts +2 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +26 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.js +71 -0
- package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +11 -0
- package/dist/components/effects/ParallaxSection/index.d.ts +2 -0
- package/dist/components/effects/Particles/Particles.d.ts +22 -0
- package/dist/components/effects/Particles/Particles.js +33 -0
- package/dist/components/effects/Particles/Particles.scene.d.ts +3 -0
- package/dist/components/effects/Particles/Particles.scene.js +284 -0
- package/dist/components/effects/Particles/Particles.types.d.ts +65 -0
- package/dist/components/effects/Particles/index.d.ts +2 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.d.ts +3 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +75 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.theme.d.ts +7 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.theme.js +12 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +47 -0
- package/dist/components/effects/ProgressiveBlur/index.d.ts +2 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.d.ts +29 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.js +121 -0
- package/dist/components/effects/ScrollReveal/ScrollReveal.types.d.ts +25 -0
- package/dist/components/effects/ScrollReveal/index.d.ts +2 -0
- package/dist/components/effects/Spotlight/Spotlight.d.ts +36 -0
- package/dist/components/effects/Spotlight/Spotlight.js +112 -0
- package/dist/components/effects/Spotlight/Spotlight.types.d.ts +29 -0
- package/dist/components/effects/Spotlight/index.d.ts +2 -0
- package/dist/components/effects/StickyScroll/StickyScroll.d.ts +30 -0
- package/dist/components/effects/StickyScroll/StickyScroll.js +128 -0
- package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +19 -0
- package/dist/components/effects/StickyScroll/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +22 -4
- package/dist/components/effects/index.js +11 -2
- package/dist/components/forms/Checkbox/Checkbox.js +3 -3
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -5
- package/dist/components/forms/ColorPicker/ColorPicker.theme.js +2 -2
- package/dist/components/forms/CronInput/CronInput.d.ts +3 -0
- package/dist/components/forms/CronInput/CronInput.js +107 -0
- package/dist/components/forms/CronInput/CronInput.theme.d.ts +6 -0
- package/dist/components/forms/CronInput/CronInput.theme.js +84 -0
- package/dist/components/forms/CronInput/CronInput.types.d.ts +98 -0
- package/dist/components/forms/CronInput/CronInput.utils.d.ts +67 -0
- package/dist/components/forms/CronInput/CronInput.utils.js +505 -0
- package/dist/components/forms/CronInput/index.d.ts +4 -0
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/InputCounter/InputCounter.d.ts +1 -1
- package/dist/components/forms/InputCounter/InputCounter.types.d.ts +3 -2
- package/dist/components/forms/InputOTP/InputOTP.theme.js +1 -1
- package/dist/components/forms/Mention/Mention.d.ts +3 -0
- package/dist/components/forms/Mention/Mention.js +410 -0
- package/dist/components/forms/Mention/Mention.theme.d.ts +6 -0
- package/dist/components/forms/Mention/Mention.theme.js +56 -0
- package/dist/components/forms/Mention/Mention.types.d.ts +111 -0
- package/dist/components/forms/Mention/index.d.ts +3 -0
- package/dist/components/forms/Radio/Radio.js +8 -12
- package/dist/components/forms/Radio/Radio.theme.js +28 -5
- package/dist/components/forms/SelectableCard/SelectableCard.animations.d.ts +2 -0
- package/dist/components/forms/SelectableCard/SelectableCard.animations.js +9 -0
- package/dist/components/forms/SelectableCard/SelectableCard.d.ts +5 -0
- package/dist/components/forms/SelectableCard/SelectableCard.js +58 -0
- package/dist/components/forms/SelectableCard/SelectableCard.theme.d.ts +2 -0
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +38 -0
- package/dist/components/forms/SelectableCard/SelectableCard.types.d.ts +33 -0
- package/dist/components/forms/SelectableCard/SelectableCardContext.d.ts +3 -0
- package/dist/components/forms/SelectableCard/SelectableCardContext.js +12 -0
- package/dist/components/forms/SelectableCard/SelectableCardGroup.d.ts +3 -0
- package/dist/components/forms/SelectableCard/SelectableCardGroup.js +37 -0
- package/dist/components/forms/SelectableCard/index.d.ts +3 -0
- package/dist/components/forms/TransferList/TransferList.animations.d.ts +10 -0
- package/dist/components/forms/TransferList/TransferList.animations.js +32 -0
- package/dist/components/forms/TransferList/TransferList.d.ts +28 -0
- package/dist/components/forms/TransferList/TransferList.js +199 -0
- package/dist/components/forms/TransferList/TransferList.theme.d.ts +6 -0
- package/dist/components/forms/TransferList/TransferList.theme.js +60 -0
- package/dist/components/forms/TransferList/TransferList.types.d.ts +101 -0
- package/dist/components/forms/TransferList/index.d.ts +3 -0
- package/dist/components/forms/index.d.ts +13 -0
- package/dist/components/forms/index.js +9 -0
- package/dist/components/layout/FormLayout/FormLayout.d.ts +8 -0
- package/dist/components/layout/FormLayout/FormLayout.js +22 -0
- package/dist/components/layout/FormLayout/FormLayout.theme.d.ts +2 -0
- package/dist/components/layout/FormLayout/FormLayout.theme.js +16 -0
- package/dist/components/layout/FormLayout/FormLayout.types.d.ts +61 -0
- package/dist/components/layout/FormLayout/FormLayoutBody.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutBody.js +13 -0
- package/dist/components/layout/FormLayout/FormLayoutFooter.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutFooter.js +12 -0
- package/dist/components/layout/FormLayout/FormLayoutHeader.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutHeader.js +12 -0
- package/dist/components/layout/FormLayout/FormLayoutSection.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayoutSection.js +12 -0
- package/dist/components/layout/FormLayout/index.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayout.d.ts +7 -0
- package/dist/components/layout/PageLayout/PageLayout.js +33 -0
- package/dist/components/layout/PageLayout/PageLayout.theme.d.ts +2 -0
- package/dist/components/layout/PageLayout/PageLayout.theme.js +10 -0
- package/dist/components/layout/PageLayout/PageLayout.types.d.ts +39 -0
- package/dist/components/layout/PageLayout/PageLayoutContent.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutContent.js +12 -0
- package/dist/components/layout/PageLayout/PageLayoutHeader.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutHeader.js +12 -0
- package/dist/components/layout/PageLayout/PageLayoutSidebar.d.ts +3 -0
- package/dist/components/layout/PageLayout/PageLayoutSidebar.js +12 -0
- package/dist/components/layout/PageLayout/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53 -21
- package/dist/styles.css +1 -1
- package/dist/utils/dateUtils.d.ts +30 -0
- package/dist/utils/dateUtils.js +58 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +26 -22
- package/dist/components/core/Card/CardDescription.d.ts +0 -3
- package/dist/components/core/Card/CardDescription.js +0 -11
- package/dist/components/core/Modal/ModalDescription.d.ts +0 -5
- package/dist/components/core/Modal/ModalDescription.js +0 -11
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.d.ts +0 -34
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.js +0 -218
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.theme.d.ts +0 -9
- package/dist/components/core/ProgressiveBlur/ProgressiveBlur.types.d.ts +0 -48
- package/dist/components/core/ProgressiveBlur/index.d.ts +0 -2
- package/dist/components/core/Table/TablePagination.js +0 -25
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.js +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/DescriptionList.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/DescriptionList/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.theme.js +0 -0
- /package/dist/components/{core → data-display}/Feed/Feed.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Feed/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/KPI/KPI.d.ts +0 -0
- /package/dist/components/{core → data-display}/KPI/KPI.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/Metric.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/Metric.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Metric/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.animations.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.animations.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.filterUtils.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.filterUtils.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.js +0 -0
- /package/dist/components/{core → data-display}/Table/Table.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.utils.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/Table.utils.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableActions.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableActionsMenu.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableActionsMenu.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableBody.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableBody.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableCell.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableCell.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableColumnManager.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableDeclarative.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableDeclarative.js +0 -0
- /package/dist/components/{core → data-display}/Table/TableFilter.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableHeader.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableHeader.js +0 -0
- /package/dist/components/{core → data-display}/Table/TablePagination.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableRow.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/TableSelectionHeader.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableColumns.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableColumns.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableExpansion.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableExpansion.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableFilter.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableFilter.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTablePagination.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTablePagination.js +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableSelection.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/hooks/useTableSelection.js +0 -0
- /package/dist/components/{core → data-display}/Table/index.d.ts +0 -0
- /package/dist/components/{core → data-display}/Table/index.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.animations.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.animations.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.theme.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.theme.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/Timeline.types.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineContent.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineContent.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineItem.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineItem.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineMarker.d.ts +0 -0
- /package/dist/components/{core → data-display}/Timeline/TimelineMarker.js +0 -0
- /package/dist/components/{core → data-display}/Timeline/index.d.ts +0 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useMemo, useState, useRef, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
5
|
+
import { mentionTheme } from './Mention.theme.js';
|
|
6
|
+
import { cn } from '../../../utils/cn.js';
|
|
7
|
+
import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Helpers
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Extract the first two initials from a label string.
|
|
14
|
+
*/
|
|
15
|
+
const getInitials = (label) => {
|
|
16
|
+
const parts = label.trim().split(/\s+/);
|
|
17
|
+
if (parts.length === 1)
|
|
18
|
+
return parts[0].charAt(0).toUpperCase();
|
|
19
|
+
return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Walk backward from the caret and detect if the user is mid-mention.
|
|
23
|
+
* Returns the active mention context or null.
|
|
24
|
+
*/
|
|
25
|
+
const detectActiveMention = (text, caretPos, triggerChars) => {
|
|
26
|
+
if (caretPos === 0)
|
|
27
|
+
return null;
|
|
28
|
+
// Scan backward from caret to find a trigger character
|
|
29
|
+
for (let i = caretPos - 1; i >= 0; i--) {
|
|
30
|
+
const ch = text[i];
|
|
31
|
+
// If we hit a whitespace or newline before finding a trigger, stop
|
|
32
|
+
// UNLESS the character is the very first character after a newline/space
|
|
33
|
+
// (which means we're looking at a potential trigger at position 0
|
|
34
|
+
// or right after whitespace).
|
|
35
|
+
if (ch === "\n")
|
|
36
|
+
return null;
|
|
37
|
+
if (triggerChars.includes(ch)) {
|
|
38
|
+
// The trigger must be at the start of the text or preceded by whitespace
|
|
39
|
+
if (i === 0 || /\s/.test(text[i - 1])) {
|
|
40
|
+
const query = text.slice(i + 1, caretPos);
|
|
41
|
+
// Reject if the query contains whitespace (multi-word queries not supported)
|
|
42
|
+
// Actually, allow spaces in the query for multi-word searches
|
|
43
|
+
return {
|
|
44
|
+
trigger: ch,
|
|
45
|
+
query,
|
|
46
|
+
startIndex: i,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Filter suggestions by a query string (case-insensitive label match).
|
|
56
|
+
*/
|
|
57
|
+
const filterSuggestions = (suggestions, query, max) => {
|
|
58
|
+
if (!query)
|
|
59
|
+
return suggestions.slice(0, max);
|
|
60
|
+
const lower = query.toLowerCase();
|
|
61
|
+
return suggestions
|
|
62
|
+
.filter((s) => s.label.toLowerCase().includes(lower) ||
|
|
63
|
+
(s.description && s.description.toLowerCase().includes(lower)))
|
|
64
|
+
.slice(0, max);
|
|
65
|
+
};
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Dropdown animation
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
const dropdownVariants = {
|
|
70
|
+
initial: { opacity: 0, y: -6, scale: 0.96 },
|
|
71
|
+
visible: {
|
|
72
|
+
opacity: 1,
|
|
73
|
+
y: 0,
|
|
74
|
+
scale: 1,
|
|
75
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
76
|
+
},
|
|
77
|
+
exit: {
|
|
78
|
+
opacity: 0,
|
|
79
|
+
y: -6,
|
|
80
|
+
scale: 0.96,
|
|
81
|
+
transition: { duration: 0.12, ease: "easeIn" },
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// Mention component
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
const Mention = React__default.forwardRef(({ triggers: triggersProp, suggestions: suggestionsProp, onSearch: onSearchProp, value: controlledValue, defaultValue = "", onChange, onMentionSelect, placeholder, size = "md", maxSuggestions = 8, className, wrapperClassName, dropdownClassName, theme: themeOverrides, disabled = false, renderSuggestion, emptyMessage = "No results found", loading = false, rows = 3, ...props }, ref) => {
|
|
88
|
+
// Merge theme
|
|
89
|
+
const theme = useMemo(() => ({ ...mentionTheme, ...(themeOverrides || {}) }), [themeOverrides]);
|
|
90
|
+
// Normalize triggers from both APIs
|
|
91
|
+
const triggers = useMemo(() => {
|
|
92
|
+
if (triggersProp && triggersProp.length > 0)
|
|
93
|
+
return triggersProp;
|
|
94
|
+
// Simple API: wrap suggestions + onSearch into a single '@' trigger
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
trigger: "@",
|
|
98
|
+
suggestions: suggestionsProp || [],
|
|
99
|
+
onSearch: onSearchProp,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
}, [triggersProp, suggestionsProp, onSearchProp]);
|
|
103
|
+
const triggerChars = useMemo(() => triggers.map((t) => t.trigger), [triggers]);
|
|
104
|
+
// Value state (controlled / uncontrolled)
|
|
105
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
106
|
+
const isControlled = controlledValue !== undefined;
|
|
107
|
+
const textValue = isControlled ? controlledValue : internalValue;
|
|
108
|
+
// Focus state for input group styling
|
|
109
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
110
|
+
// Active mention context
|
|
111
|
+
const [activeMention, setActiveMention] = useState(null);
|
|
112
|
+
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
113
|
+
// Dropdown position
|
|
114
|
+
const [dropdownPos, setDropdownPos] = useState({
|
|
115
|
+
top: -9999,
|
|
116
|
+
left: -9999,
|
|
117
|
+
width: 280,
|
|
118
|
+
});
|
|
119
|
+
// Refs
|
|
120
|
+
const textareaRef = useRef(null);
|
|
121
|
+
const wrapperRef = useRef(null);
|
|
122
|
+
const dropdownRef = useRef(null);
|
|
123
|
+
// SSR guard for portal
|
|
124
|
+
const isClient = useIsClient();
|
|
125
|
+
// Combine forwarded ref with internal ref
|
|
126
|
+
const setTextareaRef = useCallback((el) => {
|
|
127
|
+
textareaRef.current = el;
|
|
128
|
+
if (typeof ref === "function") {
|
|
129
|
+
ref(el);
|
|
130
|
+
}
|
|
131
|
+
else if (ref) {
|
|
132
|
+
ref.current =
|
|
133
|
+
el;
|
|
134
|
+
}
|
|
135
|
+
}, [ref]);
|
|
136
|
+
// Get the current trigger config for the active mention
|
|
137
|
+
const activeTriggerConfig = useMemo(() => {
|
|
138
|
+
if (!activeMention)
|
|
139
|
+
return null;
|
|
140
|
+
return triggers.find((t) => t.trigger === activeMention.trigger) || null;
|
|
141
|
+
}, [activeMention, triggers]);
|
|
142
|
+
// Filtered suggestions for the current query
|
|
143
|
+
const filteredSuggestions = useMemo(() => {
|
|
144
|
+
if (!activeTriggerConfig)
|
|
145
|
+
return [];
|
|
146
|
+
return filterSuggestions(activeTriggerConfig.suggestions, (activeMention === null || activeMention === void 0 ? void 0 : activeMention.query) || "", maxSuggestions);
|
|
147
|
+
}, [activeTriggerConfig, activeMention === null || activeMention === void 0 ? void 0 : activeMention.query, maxSuggestions]);
|
|
148
|
+
const isDropdownOpen = activeMention !== null && (filteredSuggestions.length > 0 || loading);
|
|
149
|
+
// Fire onSearch when query changes
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!activeMention || !(activeTriggerConfig === null || activeTriggerConfig === void 0 ? void 0 : activeTriggerConfig.onSearch))
|
|
152
|
+
return;
|
|
153
|
+
activeTriggerConfig.onSearch(activeMention.query);
|
|
154
|
+
}, [activeMention === null || activeMention === void 0 ? void 0 : activeMention.query, activeMention === null || activeMention === void 0 ? void 0 : activeMention.trigger]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
155
|
+
// Reset highlighted index when suggestions change
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
setHighlightedIndex(filteredSuggestions.length > 0 ? 0 : -1);
|
|
158
|
+
}, [filteredSuggestions.length, activeMention === null || activeMention === void 0 ? void 0 : activeMention.query]);
|
|
159
|
+
// -----------------------------------------------------------------------
|
|
160
|
+
// Dropdown positioning via caret coordinates
|
|
161
|
+
// -----------------------------------------------------------------------
|
|
162
|
+
/**
|
|
163
|
+
* Calculate the pixel coordinates of the caret inside the textarea using
|
|
164
|
+
* a hidden mirror div. This is the standard technique for textarea caret
|
|
165
|
+
* positioning since browsers don't expose it natively.
|
|
166
|
+
*/
|
|
167
|
+
const measureCaretPosition = useCallback(() => {
|
|
168
|
+
var _a;
|
|
169
|
+
const textarea = textareaRef.current;
|
|
170
|
+
if (!textarea)
|
|
171
|
+
return null;
|
|
172
|
+
const mirror = document.createElement("div");
|
|
173
|
+
const computed = window.getComputedStyle(textarea);
|
|
174
|
+
// Copy all relevant styles so that text wraps identically
|
|
175
|
+
const stylesToCopy = [
|
|
176
|
+
"fontFamily",
|
|
177
|
+
"fontSize",
|
|
178
|
+
"fontWeight",
|
|
179
|
+
"fontStyle",
|
|
180
|
+
"letterSpacing",
|
|
181
|
+
"textTransform",
|
|
182
|
+
"wordSpacing",
|
|
183
|
+
"textIndent",
|
|
184
|
+
"whiteSpace",
|
|
185
|
+
"wordWrap",
|
|
186
|
+
"overflowWrap",
|
|
187
|
+
"lineHeight",
|
|
188
|
+
"paddingTop",
|
|
189
|
+
"paddingRight",
|
|
190
|
+
"paddingBottom",
|
|
191
|
+
"paddingLeft",
|
|
192
|
+
"borderTopWidth",
|
|
193
|
+
"borderRightWidth",
|
|
194
|
+
"borderBottomWidth",
|
|
195
|
+
"borderLeftWidth",
|
|
196
|
+
"boxSizing",
|
|
197
|
+
];
|
|
198
|
+
mirror.style.position = "absolute";
|
|
199
|
+
mirror.style.top = "0";
|
|
200
|
+
mirror.style.left = "-9999px";
|
|
201
|
+
mirror.style.visibility = "hidden";
|
|
202
|
+
mirror.style.overflow = "hidden";
|
|
203
|
+
mirror.style.width = `${textarea.offsetWidth}px`;
|
|
204
|
+
for (const prop of stylesToCopy) {
|
|
205
|
+
mirror.style[prop] = computed.getPropertyValue(prop.replace(/([A-Z])/g, "-$1").toLowerCase());
|
|
206
|
+
}
|
|
207
|
+
// Text up to the caret
|
|
208
|
+
const caretPos = (_a = textarea.selectionStart) !== null && _a !== void 0 ? _a : 0;
|
|
209
|
+
const textBefore = textarea.value.substring(0, caretPos);
|
|
210
|
+
// Replace spaces with non-breaking spaces so whitespace is preserved
|
|
211
|
+
mirror.textContent = textBefore.replace(/ /g, "\u00a0");
|
|
212
|
+
// Place a span at the caret position to measure its coordinates
|
|
213
|
+
const caretSpan = document.createElement("span");
|
|
214
|
+
caretSpan.textContent = "\u200b"; // zero-width space
|
|
215
|
+
mirror.appendChild(caretSpan);
|
|
216
|
+
document.body.appendChild(mirror);
|
|
217
|
+
const spanRect = caretSpan.getBoundingClientRect();
|
|
218
|
+
const textareaRect = textarea.getBoundingClientRect();
|
|
219
|
+
// The span position is in the mirror; we need to offset by the textarea's
|
|
220
|
+
// actual position and account for scrollTop.
|
|
221
|
+
const relativeTop = spanRect.top - mirror.getBoundingClientRect().top - textarea.scrollTop;
|
|
222
|
+
const relativeLeft = spanRect.left - mirror.getBoundingClientRect().left;
|
|
223
|
+
document.body.removeChild(mirror);
|
|
224
|
+
return {
|
|
225
|
+
top: textareaRect.top + relativeTop,
|
|
226
|
+
left: textareaRect.left + relativeLeft,
|
|
227
|
+
};
|
|
228
|
+
}, []);
|
|
229
|
+
const updateDropdownPosition = useCallback(() => {
|
|
230
|
+
const pos = measureCaretPosition();
|
|
231
|
+
if (!pos)
|
|
232
|
+
return;
|
|
233
|
+
const lineHeight = parseFloat(window.getComputedStyle(textareaRef.current).lineHeight || "20");
|
|
234
|
+
setDropdownPos({
|
|
235
|
+
top: pos.top + lineHeight + 4,
|
|
236
|
+
left: pos.left,
|
|
237
|
+
width: 280,
|
|
238
|
+
});
|
|
239
|
+
}, [measureCaretPosition]);
|
|
240
|
+
// Reposition dropdown whenever the active mention changes
|
|
241
|
+
useLayoutEffect(() => {
|
|
242
|
+
if (activeMention) {
|
|
243
|
+
updateDropdownPosition();
|
|
244
|
+
}
|
|
245
|
+
}, [activeMention, updateDropdownPosition]);
|
|
246
|
+
// Reposition on scroll / resize
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
if (!isDropdownOpen)
|
|
249
|
+
return;
|
|
250
|
+
const handleReposition = () => updateDropdownPosition();
|
|
251
|
+
window.addEventListener("scroll", handleReposition, {
|
|
252
|
+
passive: true,
|
|
253
|
+
capture: true,
|
|
254
|
+
});
|
|
255
|
+
window.addEventListener("resize", handleReposition, { passive: true });
|
|
256
|
+
return () => {
|
|
257
|
+
window.removeEventListener("scroll", handleReposition, true);
|
|
258
|
+
window.removeEventListener("resize", handleReposition);
|
|
259
|
+
};
|
|
260
|
+
}, [isDropdownOpen, updateDropdownPosition]);
|
|
261
|
+
// -----------------------------------------------------------------------
|
|
262
|
+
// Click outside to close dropdown
|
|
263
|
+
// -----------------------------------------------------------------------
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
if (!isDropdownOpen)
|
|
266
|
+
return;
|
|
267
|
+
const handleClickOutside = (e) => {
|
|
268
|
+
if (dropdownRef.current &&
|
|
269
|
+
!dropdownRef.current.contains(e.target) &&
|
|
270
|
+
textareaRef.current &&
|
|
271
|
+
!textareaRef.current.contains(e.target)) {
|
|
272
|
+
setActiveMention(null);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
276
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
277
|
+
}, [isDropdownOpen]);
|
|
278
|
+
// -----------------------------------------------------------------------
|
|
279
|
+
// Handlers
|
|
280
|
+
// -----------------------------------------------------------------------
|
|
281
|
+
const setValue = useCallback((newValue) => {
|
|
282
|
+
if (!isControlled) {
|
|
283
|
+
setInternalValue(newValue);
|
|
284
|
+
}
|
|
285
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
286
|
+
}, [isControlled, onChange]);
|
|
287
|
+
const handleChange = useCallback((e) => {
|
|
288
|
+
var _a;
|
|
289
|
+
const newValue = e.target.value;
|
|
290
|
+
setValue(newValue);
|
|
291
|
+
// Detect active mention from the caret position
|
|
292
|
+
const caretPos = (_a = e.target.selectionStart) !== null && _a !== void 0 ? _a : newValue.length;
|
|
293
|
+
const mention = detectActiveMention(newValue, caretPos, triggerChars);
|
|
294
|
+
setActiveMention(mention);
|
|
295
|
+
}, [setValue, triggerChars]);
|
|
296
|
+
const handleSelect = useCallback((e) => {
|
|
297
|
+
var _a;
|
|
298
|
+
// When the caret moves (click, arrow keys), recheck for active mention
|
|
299
|
+
const textarea = e.currentTarget;
|
|
300
|
+
const caretPos = (_a = textarea.selectionStart) !== null && _a !== void 0 ? _a : 0;
|
|
301
|
+
const mention = detectActiveMention(textarea.value, caretPos, triggerChars);
|
|
302
|
+
setActiveMention(mention);
|
|
303
|
+
}, [triggerChars]);
|
|
304
|
+
const insertMention = useCallback((suggestion) => {
|
|
305
|
+
if (!activeMention || !textareaRef.current)
|
|
306
|
+
return;
|
|
307
|
+
const { trigger, startIndex, query } = activeMention;
|
|
308
|
+
const before = textValue.slice(0, startIndex);
|
|
309
|
+
const after = textValue.slice(startIndex + 1 + query.length); // +1 for trigger char
|
|
310
|
+
const insertText = `${trigger}${suggestion.label} `;
|
|
311
|
+
const newValue = before + insertText + after;
|
|
312
|
+
setValue(newValue);
|
|
313
|
+
setActiveMention(null);
|
|
314
|
+
setHighlightedIndex(-1);
|
|
315
|
+
onMentionSelect === null || onMentionSelect === void 0 ? void 0 : onMentionSelect(suggestion, trigger);
|
|
316
|
+
// Move the caret to after the inserted mention
|
|
317
|
+
const newCaretPos = before.length + insertText.length;
|
|
318
|
+
requestAnimationFrame(() => {
|
|
319
|
+
if (textareaRef.current) {
|
|
320
|
+
textareaRef.current.focus();
|
|
321
|
+
textareaRef.current.selectionStart = newCaretPos;
|
|
322
|
+
textareaRef.current.selectionEnd = newCaretPos;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}, [activeMention, textValue, setValue, onMentionSelect]);
|
|
326
|
+
const handleKeyDown = useCallback((e) => {
|
|
327
|
+
if (!isDropdownOpen)
|
|
328
|
+
return;
|
|
329
|
+
switch (e.key) {
|
|
330
|
+
case "ArrowDown":
|
|
331
|
+
e.preventDefault();
|
|
332
|
+
setHighlightedIndex((prev) => prev >= filteredSuggestions.length - 1 ? 0 : prev + 1);
|
|
333
|
+
break;
|
|
334
|
+
case "ArrowUp":
|
|
335
|
+
e.preventDefault();
|
|
336
|
+
setHighlightedIndex((prev) => prev <= 0 ? filteredSuggestions.length - 1 : prev - 1);
|
|
337
|
+
break;
|
|
338
|
+
case "Enter":
|
|
339
|
+
if (highlightedIndex >= 0 && highlightedIndex < filteredSuggestions.length) {
|
|
340
|
+
e.preventDefault();
|
|
341
|
+
insertMention(filteredSuggestions[highlightedIndex]);
|
|
342
|
+
}
|
|
343
|
+
break;
|
|
344
|
+
case "Escape":
|
|
345
|
+
e.preventDefault();
|
|
346
|
+
setActiveMention(null);
|
|
347
|
+
break;
|
|
348
|
+
case "Tab":
|
|
349
|
+
// Close dropdown on tab without preventing default
|
|
350
|
+
setActiveMention(null);
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}, [isDropdownOpen, highlightedIndex, filteredSuggestions, insertMention]);
|
|
354
|
+
const handleFocus = useCallback((e) => {
|
|
355
|
+
var _a;
|
|
356
|
+
setIsFocused(true);
|
|
357
|
+
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
358
|
+
}, [props.onFocus]);
|
|
359
|
+
const handleBlur = useCallback((e) => {
|
|
360
|
+
var _a;
|
|
361
|
+
setIsFocused(false);
|
|
362
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
363
|
+
}, [props.onBlur]);
|
|
364
|
+
// Scroll highlighted suggestion into view
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (highlightedIndex >= 0 && dropdownRef.current) {
|
|
367
|
+
const item = dropdownRef.current.querySelector(`[data-suggestion-index="${highlightedIndex}"]`);
|
|
368
|
+
if (item) {
|
|
369
|
+
item.scrollIntoView({ block: "nearest" });
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, [highlightedIndex]);
|
|
373
|
+
// -----------------------------------------------------------------------
|
|
374
|
+
// Render suggestion item
|
|
375
|
+
// -----------------------------------------------------------------------
|
|
376
|
+
const renderSuggestionItem = (suggestion, index) => {
|
|
377
|
+
const isHighlighted = index === highlightedIndex;
|
|
378
|
+
const triggerChar = (activeMention === null || activeMention === void 0 ? void 0 : activeMention.trigger) || "@";
|
|
379
|
+
// Custom renderer
|
|
380
|
+
if (renderSuggestion) {
|
|
381
|
+
return (jsx("div", { role: "option", "aria-selected": isHighlighted, "data-suggestion-index": index, className: cn(theme.suggestionStyle, isHighlighted && theme.suggestionHighlightedStyle), onMouseEnter: () => setHighlightedIndex(index), onMouseDown: (e) => {
|
|
382
|
+
e.preventDefault(); // Prevent textarea blur
|
|
383
|
+
insertMention(suggestion);
|
|
384
|
+
}, children: renderSuggestion(suggestion, isHighlighted, triggerChar) }, suggestion.id));
|
|
385
|
+
}
|
|
386
|
+
return (jsxs("div", { role: "option", "aria-selected": isHighlighted, "data-suggestion-index": index, className: cn(theme.suggestionStyle, isHighlighted && theme.suggestionHighlightedStyle), onMouseEnter: () => setHighlightedIndex(index), onMouseDown: (e) => {
|
|
387
|
+
e.preventDefault(); // Prevent textarea blur
|
|
388
|
+
insertMention(suggestion);
|
|
389
|
+
}, children: [suggestion.avatar ? (jsx("img", { src: suggestion.avatar, alt: suggestion.label, className: theme.suggestionAvatarStyle })) : (jsx("div", { className: theme.suggestionAvatarFallbackStyle, children: getInitials(suggestion.label) })), jsxs("div", { className: "flex flex-col min-w-0", children: [jsx("span", { className: theme.suggestionLabelStyle, children: suggestion.label }), suggestion.description && (jsx("span", { className: theme.suggestionDescriptionStyle, children: suggestion.description }))] })] }, suggestion.id));
|
|
390
|
+
};
|
|
391
|
+
// -----------------------------------------------------------------------
|
|
392
|
+
// Dropdown portal content
|
|
393
|
+
// -----------------------------------------------------------------------
|
|
394
|
+
const dropdownContent = (jsx(AnimatePresence, { mode: "wait", children: isDropdownOpen && (jsx(motion.div, { ref: dropdownRef, role: "listbox", "aria-label": "Suggestions", className: cn(theme.dropdownStyle, dropdownClassName), style: {
|
|
395
|
+
position: "fixed",
|
|
396
|
+
top: `${dropdownPos.top}px`,
|
|
397
|
+
left: `${dropdownPos.left}px`,
|
|
398
|
+
minWidth: `${dropdownPos.width}px`,
|
|
399
|
+
maxWidth: "360px",
|
|
400
|
+
zIndex: 1000,
|
|
401
|
+
overscrollBehavior: "contain",
|
|
402
|
+
}, variants: dropdownVariants, initial: "initial", animate: "visible", exit: "exit", children: loading ? (jsx("div", { className: theme.loadingStyle, children: "Searching..." })) : filteredSuggestions.length === 0 ? (jsx("div", { className: theme.emptyMessageStyle, children: emptyMessage })) : (filteredSuggestions.map((suggestion, index) => renderSuggestionItem(suggestion, index))) })) }));
|
|
403
|
+
// -----------------------------------------------------------------------
|
|
404
|
+
// Render
|
|
405
|
+
// -----------------------------------------------------------------------
|
|
406
|
+
return (jsxs("div", { className: cn(theme.wrapperStyle, wrapperClassName), children: [jsx("div", { ref: wrapperRef, className: cn(theme.inputGroupStyle, isFocused && theme.inputGroupFocusStyle), children: jsx("textarea", { ref: setTextareaRef, value: textValue, onChange: handleChange, onSelect: handleSelect, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, placeholder: placeholder, disabled: disabled, rows: rows, role: "textbox", "aria-multiline": "true", "aria-autocomplete": "list", "aria-expanded": isDropdownOpen, "aria-haspopup": "listbox", className: cn(theme.textareaStyle, theme.sizes[size], className), ...props }) }), isClient && createPortal(dropdownContent, document.body)] }));
|
|
407
|
+
});
|
|
408
|
+
Mention.displayName = "Mention";
|
|
409
|
+
|
|
410
|
+
export { Mention };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { formsBaseTheme } from '../forms.theme.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default theme for the Mention component.
|
|
5
|
+
* Uses the shared forms base theme for consistency with Input/Textarea.
|
|
6
|
+
*/
|
|
7
|
+
const mentionTheme = {
|
|
8
|
+
// Outermost wrapper
|
|
9
|
+
wrapperStyle: formsBaseTheme.wrapperStyle,
|
|
10
|
+
// Input group container with outline and focus ring
|
|
11
|
+
inputGroupStyle: formsBaseTheme.inputGroupBaseStyle,
|
|
12
|
+
// JS-driven focus ring (applied when textarea is focused)
|
|
13
|
+
inputGroupFocusStyle: "outline-2 outline-[var(--color-primary-600)] -outline-offset-1 " +
|
|
14
|
+
"ring-4 ring-[var(--color-primary)]/10 " +
|
|
15
|
+
"dark:outline-[var(--color-primary-500)] dark:ring-[var(--color-primary-500)]/20",
|
|
16
|
+
// Base textarea styles
|
|
17
|
+
textareaStyle: `${formsBaseTheme.controlBaseStyle} resize-y`,
|
|
18
|
+
// Size variants
|
|
19
|
+
sizes: {
|
|
20
|
+
sm: `${formsBaseTheme.sizes.sm.text} ${formsBaseTheme.sizes.sm.padding} ${formsBaseTheme.sizes.sm.textareaHeight}`,
|
|
21
|
+
md: `${formsBaseTheme.sizes.md.text} ${formsBaseTheme.sizes.md.padding} ${formsBaseTheme.sizes.md.textareaHeight}`,
|
|
22
|
+
lg: `${formsBaseTheme.sizes.lg.text} ${formsBaseTheme.sizes.lg.padding} ${formsBaseTheme.sizes.lg.textareaHeight}`,
|
|
23
|
+
},
|
|
24
|
+
// Dropdown container - reuses the shared dropdown styles
|
|
25
|
+
dropdownStyle: formsBaseTheme.dropdownStyles.container + " py-1",
|
|
26
|
+
// Individual suggestion item
|
|
27
|
+
suggestionStyle: "relative flex items-center gap-2.5 cursor-pointer select-none py-2 px-3 " +
|
|
28
|
+
"text-[var(--color-text-primary)] " +
|
|
29
|
+
"hover:text-[var(--color-primary)] hover:bg-[var(--color-primary-50)]/50 " +
|
|
30
|
+
"dark:hover:text-[var(--color-primary-400)] dark:hover:bg-[var(--color-primary-400)]/10",
|
|
31
|
+
// Highlighted suggestion (keyboard navigation)
|
|
32
|
+
suggestionHighlightedStyle: "text-[var(--color-primary)] bg-[var(--color-primary-50)]/50 " +
|
|
33
|
+
"dark:text-[var(--color-primary-400)] dark:bg-[var(--color-primary-400)]/10",
|
|
34
|
+
// Avatar image
|
|
35
|
+
suggestionAvatarStyle: "size-7 rounded-full object-cover shrink-0 " +
|
|
36
|
+
"bg-[var(--color-background-tertiary)] dark:bg-[var(--color-neutral-700)]",
|
|
37
|
+
// Avatar fallback (initials circle)
|
|
38
|
+
suggestionAvatarFallbackStyle: "size-7 rounded-full shrink-0 flex items-center justify-center text-xs font-medium " +
|
|
39
|
+
"bg-[var(--color-primary-100)] text-[var(--color-primary-700)] " +
|
|
40
|
+
"dark:bg-[var(--color-primary-900)] dark:text-[var(--color-primary-300)]",
|
|
41
|
+
// Suggestion label text
|
|
42
|
+
suggestionLabelStyle: "text-sm font-medium truncate",
|
|
43
|
+
// Suggestion description text
|
|
44
|
+
suggestionDescriptionStyle: "text-xs text-[var(--color-text-muted)] truncate " +
|
|
45
|
+
"dark:text-[var(--color-neutral-500)]",
|
|
46
|
+
// Empty state
|
|
47
|
+
emptyMessageStyle: formsBaseTheme.dropdownStyles.emptyMessage,
|
|
48
|
+
// Loading state
|
|
49
|
+
loadingStyle: "py-3 px-3 text-center text-[var(--color-text-muted)] " +
|
|
50
|
+
"dark:text-[var(--color-neutral-500)]",
|
|
51
|
+
// Highlighted mention text in the overlay
|
|
52
|
+
mentionHighlightStyle: "text-[var(--color-primary)] font-medium " +
|
|
53
|
+
"dark:text-[var(--color-primary-400)]",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { mentionTheme };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A single suggestion item displayed in the mention dropdown.
|
|
4
|
+
*/
|
|
5
|
+
export interface MentionSuggestion {
|
|
6
|
+
/** Unique identifier for the suggestion */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Display label (e.g. user name, tag name) */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Optional avatar URL */
|
|
11
|
+
avatar?: string;
|
|
12
|
+
/** Optional description line (e.g. job title, email) */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** Allow arbitrary metadata */
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for a single trigger character and its suggestions.
|
|
19
|
+
*/
|
|
20
|
+
export interface MentionTrigger {
|
|
21
|
+
/** The trigger character (e.g. '@', '#') */
|
|
22
|
+
trigger: string;
|
|
23
|
+
/** Available suggestions for this trigger */
|
|
24
|
+
suggestions: MentionSuggestion[];
|
|
25
|
+
/** Async search callback invoked when the user types after the trigger */
|
|
26
|
+
onSearch?: (query: string) => void | Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Size variants for the Mention component.
|
|
30
|
+
*/
|
|
31
|
+
export type MentionSize = "sm" | "md" | "lg";
|
|
32
|
+
/**
|
|
33
|
+
* Theme configuration for the Mention component.
|
|
34
|
+
*/
|
|
35
|
+
export interface MentionTheme {
|
|
36
|
+
/** Outermost wrapper style */
|
|
37
|
+
wrapperStyle: string;
|
|
38
|
+
/** Input group container style (border, focus ring) */
|
|
39
|
+
inputGroupStyle: string;
|
|
40
|
+
/** JS-driven focus ring style */
|
|
41
|
+
inputGroupFocusStyle: string;
|
|
42
|
+
/** Base textarea style */
|
|
43
|
+
textareaStyle: string;
|
|
44
|
+
/** Size variants for the textarea */
|
|
45
|
+
sizes: Record<MentionSize, string>;
|
|
46
|
+
/** Dropdown container style */
|
|
47
|
+
dropdownStyle: string;
|
|
48
|
+
/** Individual suggestion item style */
|
|
49
|
+
suggestionStyle: string;
|
|
50
|
+
/** Highlighted (keyboard-focused) suggestion style */
|
|
51
|
+
suggestionHighlightedStyle: string;
|
|
52
|
+
/** Avatar style inside a suggestion */
|
|
53
|
+
suggestionAvatarStyle: string;
|
|
54
|
+
/** Avatar fallback (initials) style */
|
|
55
|
+
suggestionAvatarFallbackStyle: string;
|
|
56
|
+
/** Suggestion label text style */
|
|
57
|
+
suggestionLabelStyle: string;
|
|
58
|
+
/** Suggestion description text style */
|
|
59
|
+
suggestionDescriptionStyle: string;
|
|
60
|
+
/** Empty state message style */
|
|
61
|
+
emptyMessageStyle: string;
|
|
62
|
+
/** Loading state style */
|
|
63
|
+
loadingStyle: string;
|
|
64
|
+
/** Highlighted mention text overlay style */
|
|
65
|
+
mentionHighlightStyle: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Partial theme overrides for the Mention component.
|
|
69
|
+
*/
|
|
70
|
+
export type MentionThemeOverrides = Partial<MentionTheme>;
|
|
71
|
+
/**
|
|
72
|
+
* Props for the Mention component.
|
|
73
|
+
*/
|
|
74
|
+
export interface MentionProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "value" | "defaultValue"> {
|
|
75
|
+
/** Multiple trigger configurations (e.g. '@' for users, '#' for tags) */
|
|
76
|
+
triggers?: MentionTrigger[];
|
|
77
|
+
/** Simple API: suggestions for the default '@' trigger */
|
|
78
|
+
suggestions?: MentionSuggestion[];
|
|
79
|
+
/** Simple API: async search callback for the default '@' trigger */
|
|
80
|
+
onSearch?: (query: string) => void;
|
|
81
|
+
/** Controlled value */
|
|
82
|
+
value?: string;
|
|
83
|
+
/** Uncontrolled default value */
|
|
84
|
+
defaultValue?: string;
|
|
85
|
+
/** Change callback with the full text value */
|
|
86
|
+
onChange?: (value: string) => void;
|
|
87
|
+
/** Callback when a suggestion is selected */
|
|
88
|
+
onMentionSelect?: (suggestion: MentionSuggestion, trigger: string) => void;
|
|
89
|
+
/** Placeholder text */
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
/** Size variant */
|
|
92
|
+
size?: MentionSize;
|
|
93
|
+
/** Maximum number of suggestions shown */
|
|
94
|
+
maxSuggestions?: number;
|
|
95
|
+
/** Additional className for the textarea */
|
|
96
|
+
className?: string;
|
|
97
|
+
/** Additional className for the wrapper */
|
|
98
|
+
wrapperClassName?: string;
|
|
99
|
+
/** Additional className for the dropdown */
|
|
100
|
+
dropdownClassName?: string;
|
|
101
|
+
/** Theme overrides */
|
|
102
|
+
theme?: MentionThemeOverrides;
|
|
103
|
+
/** Whether the mention input is disabled */
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/** Custom renderer for suggestion items */
|
|
106
|
+
renderSuggestion?: (suggestion: MentionSuggestion, isHighlighted: boolean, trigger: string) => React.ReactNode;
|
|
107
|
+
/** Message shown when no suggestions match */
|
|
108
|
+
emptyMessage?: string;
|
|
109
|
+
/** Whether a search is currently loading */
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { radioTheme } from './Radio.theme.js';
|
|
4
|
-
import {
|
|
4
|
+
import { formLabelTheme } from '../FormLabel/FormLabel.theme.js';
|
|
5
5
|
import { cn } from '../../../utils/cn.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Radio component for selecting one option from a group
|
|
9
9
|
*/
|
|
10
|
-
const Radio = React__default.forwardRef(({ id, name, value, checked
|
|
11
|
-
const
|
|
12
|
-
// Determine if component is controlled or uncontrolled
|
|
13
|
-
const isControlled = controlledChecked !== undefined;
|
|
14
|
-
const isChecked = isControlled ? controlledChecked : internalChecked;
|
|
15
|
-
// Derive state flags
|
|
10
|
+
const Radio = React__default.forwardRef(({ id, name, value, checked, defaultChecked, onChange, label, description, state = "default", size = "md", className, ...restProps }, ref) => {
|
|
11
|
+
const isControlled = checked !== undefined;
|
|
16
12
|
const isDisabled = state === "disabled";
|
|
17
13
|
const handleChange = (e) => {
|
|
18
14
|
if (isDisabled)
|
|
19
15
|
return;
|
|
20
|
-
if (!isControlled) {
|
|
21
|
-
setInternalChecked(e.target.checked);
|
|
22
|
-
}
|
|
23
16
|
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked, value);
|
|
24
17
|
};
|
|
25
|
-
|
|
18
|
+
const inputProps = isControlled
|
|
19
|
+
? { checked }
|
|
20
|
+
: { defaultChecked };
|
|
21
|
+
return (jsxs("div", { className: cn(radioTheme.baseStyle, className), ...restProps, children: [jsxs("div", { className: cn(radioTheme.inputContainerStyle, radioTheme.sizes[size]), children: [jsx("input", { ref: ref, type: "radio", id: id, name: name, value: value, ...inputProps, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "data-state": isDisabled ? "disabled" : "default", className: cn("peer", radioTheme.inputStyle, radioTheme.sizes[size]) }), jsx("div", { className: cn(radioTheme.dotStyle, size === "sm" ? "size-2.5 top-0.25" : "size-3") })] }), (label || description) && (jsxs("label", { htmlFor: id, className: cn("cursor-pointer", isDisabled && "cursor-not-allowed"), children: [label && (jsx("span", { className: cn(formLabelTheme.baseStyle, formLabelTheme.stateStyles[state], "mb-0"), children: label })), description && (jsx("div", { id: `${id}-description`, className: radioTheme.descriptionStyle, children: description }))] }))] }));
|
|
26
22
|
});
|
|
27
23
|
Radio.displayName = "Radio";
|
|
28
24
|
|