@flikk/ui 1.0.0-beta.1 → 1.0.0-beta.11
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 +3 -2
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +2 -2
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +2 -2
- package/dist/components/ai/PromptInput/PromptInput.animations.d.ts +25 -0
- package/dist/components/ai/PromptInput/PromptInput.animations.js +61 -0
- package/dist/components/ai/PromptInput/PromptInput.js +264 -31
- package/dist/components/ai/PromptInput/PromptInput.theme.js +6 -1
- package/dist/components/ai/PromptInput/PromptInput.types.d.ts +68 -0
- package/dist/components/ai/PromptInput/VoiceRecorder.d.ts +10 -0
- package/dist/components/ai/PromptInput/VoiceRecorder.js +258 -0
- package/dist/components/ai/PromptInput/VoiceRecorder.types.d.ts +17 -0
- package/dist/components/ai/PromptInput/index.d.ts +1 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +1 -1
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.d.ts +5 -2
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +51 -27
- package/dist/components/ai/StreamingResponse/StreamingCursor.d.ts +4 -5
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +5 -12
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.d.ts +7 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +20 -1
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +2 -2
- package/dist/components/ai/StreamingResponse/StreamingResponse.theme.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +2 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +27 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +134 -0
- package/dist/components/ai/StreamingResponse/index.d.ts +3 -1
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.theme.js +2 -2
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +6 -6
- package/dist/components/ai/index.js +1 -0
- package/dist/components/charts/ActivityRings/ActivityRings.js +1 -1
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +2 -2
- package/dist/components/charts/BarChart/BarChart.js +3 -3
- package/dist/components/charts/ChartContainer.js +1 -1
- package/dist/components/charts/ComboChart/ComboChart.js +2 -2
- package/dist/components/charts/DonutChart/DonutChart.theme.js +1 -1
- package/dist/components/charts/DonutChart/DonutChart.types.d.ts +1 -2
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.theme.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.types.d.ts +1 -2
- package/dist/components/charts/FunnelChart/FunnelChart.js +7 -7
- package/dist/components/charts/Heatmap/Heatmap.theme.js +1 -1
- package/dist/components/charts/Heatmap/HeatmapCell.js +1 -1
- package/dist/components/charts/Heatmap/HeatmapLegend.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.theme.js +2 -2
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +1 -1
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +2 -2
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +2 -2
- package/dist/components/charts/shared/ChartErrorBoundary/ChartErrorBoundary.js +1 -1
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.js +1 -1
- package/dist/components/charts/shared/ChartText/ChartText.js +1 -1
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +1 -1
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.theme.js +4 -4
- package/dist/components/core/Accordion/Accordion.animations.d.ts +6 -1
- package/dist/components/core/Accordion/Accordion.animations.js +15 -1
- package/dist/components/core/Accordion/Accordion.theme.js +5 -5
- package/dist/components/core/Accordion/Accordion.types.d.ts +25 -0
- package/dist/components/core/Accordion/AccordionContent.js +1 -1
- package/dist/components/core/Accordion/AccordionTrigger.js +11 -6
- package/dist/components/core/Alert/Alert.js +3 -2
- package/dist/components/core/Alert/Alert.theme.js +4 -8
- package/dist/components/core/Alert/Alert.types.d.ts +4 -3
- 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/Avatar/Avatar.theme.js +5 -5
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +1 -1
- 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 +24 -20
- package/dist/components/core/Badge/Badge.types.d.ts +10 -5
- package/dist/components/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/core/Button/Button.d.ts +1 -1
- package/dist/components/core/Button/Button.js +21 -18
- package/dist/components/core/Button/Button.ripple.d.ts +5 -1
- package/dist/components/core/Button/Button.ripple.js +27 -17
- package/dist/components/core/Button/Button.theme.d.ts +1 -2
- package/dist/components/core/Button/Button.theme.js +46 -41
- package/dist/components/core/Button/Button.types.d.ts +3 -3
- package/dist/components/core/Button/index.d.ts +2 -0
- package/dist/components/core/ButtonGroup/ButtonGroup.theme.js +1 -1
- package/dist/components/core/Calendar/Calendar.js +1 -1
- package/dist/components/core/Calendar/Calendar.theme.js +9 -9
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.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 +2 -2
- package/dist/components/core/Card/Card.types.d.ts +7 -27
- package/dist/components/core/Card/CardSubtitle.d.ts +3 -0
- package/dist/components/core/Card/CardSubtitle.js +11 -0
- package/dist/components/core/Card/CardTitle.d.ts +1 -1
- 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 +6 -6
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +3 -3
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +1 -1
- package/dist/components/core/ContextMenu/ContextMenuItem.js +3 -3
- 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.d.ts +2 -0
- package/dist/components/core/Drawer/Drawer.theme.js +15 -13
- package/dist/components/core/Drawer/Drawer.types.d.ts +26 -9
- package/dist/components/core/Drawer/DrawerContent.js +1 -1
- package/dist/components/core/Drawer/DrawerHeader.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerHeader.js +15 -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.theme.js +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/Dropdown/DropdownMenu.js +1 -0
- 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/Kbd/Kbd.theme.js +3 -3
- 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/Loader/Loader.theme.js +1 -1
- 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 +9 -11
- 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 +6 -6
- package/dist/components/core/Modal/Modal.types.d.ts +4 -4
- package/dist/components/core/Modal/ModalHeader.js +1 -0
- 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/NavItem/NavItem.js +1 -1
- package/dist/components/core/NavItem/NavItem.theme.js +1 -1
- package/dist/components/core/OfflineIndicator/OfflineIndicator.theme.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/Pagination/Pagination.theme.js +2 -2
- package/dist/components/core/Pill/Pill.theme.js +3 -3
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/Popover/Popover.types.d.ts +6 -0
- package/dist/components/core/Popover/PopoverContent.js +8 -2
- package/dist/components/core/Progress/Progress.theme.js +10 -7
- package/dist/components/core/Progress/Progress.types.d.ts +2 -1
- package/dist/components/core/Segmented/Segmented.theme.js +5 -5
- package/dist/components/core/Sidebar/Sidebar.js +1 -0
- package/dist/components/core/Sidebar/SidebarNavGroup.js +1 -1
- 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/Spinner/Spinner.theme.js +3 -5
- package/dist/components/core/Spinner/Spinner.types.d.ts +2 -1
- package/dist/components/core/Tabs/Tabs.theme.js +2 -2
- package/dist/components/core/Tag/Tag.d.ts +2 -2
- package/dist/components/core/Tag/Tag.js +21 -4
- package/dist/components/core/Tag/Tag.theme.js +12 -4
- package/dist/components/core/Tag/Tag.types.d.ts +24 -1
- package/dist/components/core/Toast/Toast.js +4 -4
- package/dist/components/core/Toast/Toast.theme.js +4 -4
- package/dist/components/core/Toast/Toast.types.d.ts +9 -9
- package/dist/components/core/Toast/useToast.js +6 -6
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/Tree/Tree.theme.js +1 -1
- package/dist/components/core/index.d.ts +2 -7
- package/dist/components/core/index.js +10 -19
- package/dist/components/data-display/DescriptionList/DescriptionList.theme.js +8 -0
- package/dist/components/{core → data-display}/Feed/Feed.js +3 -3
- package/dist/components/{core → data-display}/Feed/Feed.theme.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 +29 -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 +12 -12
- package/dist/components/{core → data-display}/KPI/KPI.types.d.ts +6 -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 +17 -13
- package/dist/components/{core → data-display}/Metric/Metric.types.d.ts +8 -7
- package/dist/components/{core → data-display}/Table/Table.theme.js +4 -4
- package/dist/components/{core → data-display}/Table/TableActions.js +8 -8
- package/dist/components/{core → data-display}/Table/TableActionsMenu.js +1 -1
- package/dist/components/{core → data-display}/Table/TableColumnManager.js +6 -5
- package/dist/components/{core → data-display}/Table/TableFilter.js +6 -6
- package/dist/components/{core → data-display}/Table/TableHeader.js +1 -1
- 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 +3 -3
- package/dist/components/{core → data-display}/Timeline/Timeline.theme.js +2 -2
- 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.js +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +3 -1
- package/dist/components/effects/CustomCursor/CustomCursor.types.d.ts +5 -4
- 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.d.ts +3 -4
- package/dist/components/forms/Checkbox/Checkbox.js +36 -12
- package/dist/components/forms/Checkbox/Checkbox.theme.js +9 -5
- package/dist/components/forms/Checkbox/Checkbox.types.d.ts +28 -2
- package/dist/components/forms/Checkbox/CheckboxContext.d.ts +14 -0
- package/dist/components/forms/Checkbox/CheckboxContext.js +12 -0
- package/dist/components/forms/Checkbox/CheckboxGroup.d.ts +3 -0
- package/dist/components/forms/Checkbox/CheckboxGroup.js +40 -0
- package/dist/components/forms/Checkbox/index.d.ts +1 -1
- package/dist/components/forms/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPicker.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerInput.js +7 -7
- 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 +3 -3
- package/dist/components/forms/DatePicker/DatePickerContent.js +1 -1
- package/dist/components/forms/FileUpload/FileUpload.js +80 -2
- package/dist/components/forms/FileUpload/FileUpload.theme.js +4 -4
- package/dist/components/forms/FormLabel/FormLabel.theme.js +1 -1
- package/dist/components/forms/Input/Input.theme.js +1 -1
- package/dist/components/forms/InputCounter/InputCounter.d.ts +1 -1
- package/dist/components/forms/InputCounter/InputCounter.theme.js +1 -1
- package/dist/components/forms/InputCounter/InputCounter.types.d.ts +3 -2
- package/dist/components/forms/InputOTP/InputOTP.theme.js +2 -2
- package/dist/components/forms/InputTag/InputTag.js +1 -1
- package/dist/components/forms/Mention/Mention.d.ts +3 -0
- package/dist/components/forms/Mention/Mention.js +607 -0
- package/dist/components/forms/Mention/Mention.theme.d.ts +6 -0
- package/dist/components/forms/Mention/Mention.theme.js +55 -0
- package/dist/components/forms/Mention/Mention.types.d.ts +151 -0
- package/dist/components/forms/Mention/Mention.utils.d.ts +42 -0
- package/dist/components/forms/Mention/Mention.utils.js +285 -0
- package/dist/components/forms/Mention/index.d.ts +3 -0
- package/dist/components/forms/Radio/Radio.d.ts +3 -4
- package/dist/components/forms/Radio/Radio.js +25 -12
- package/dist/components/forms/Radio/Radio.theme.js +34 -5
- package/dist/components/forms/Radio/Radio.types.d.ts +30 -4
- package/dist/components/forms/Radio/RadioContext.d.ts +14 -0
- package/dist/components/forms/Radio/RadioContext.js +12 -0
- package/dist/components/forms/Radio/RadioGroup.d.ts +3 -0
- package/dist/components/forms/Radio/RadioGroup.js +36 -0
- package/dist/components/forms/Radio/index.d.ts +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +1 -1
- package/dist/components/forms/Select/Select.theme.js +1 -1
- 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/Signature/Signature.theme.js +1 -1
- package/dist/components/forms/Slider/Slider.theme.js +3 -3
- package/dist/components/forms/Switch/Switch.theme.js +1 -1
- package/dist/components/forms/TimePicker/TimePicker.theme.js +2 -2
- package/dist/components/forms/TimePicker/TimePickerContent.js +78 -1
- 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/forms.theme.js +6 -6
- package/dist/components/forms/index.d.ts +15 -2
- package/dist/components/forms/index.js +87 -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 +91 -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/hooks/useSelectPortal.d.ts +4 -2
- package/dist/hooks/useSelectPortal.js +139 -51
- package/dist/index.d.ts +2 -0
- package/dist/index.js +206 -167
- package/dist/styles.css +1 -1
- package/dist/utils/colorUtils.d.ts +23 -0
- package/dist/utils/colorUtils.js +45 -0
- package/dist/utils/dateUtils.d.ts +30 -0
- package/dist/utils/dateUtils.js +58 -1
- package/dist/utils/index.d.ts +2 -1
- package/package.json +38 -26
- package/src/global.scss +673 -0
- package/src/styles/theme.css +378 -0
- package/src/theme-plugin.css +11 -0
- package/dist/components/core/Button/Button.animations.d.ts +0 -5
- package/dist/components/core/Card/CardDescription.d.ts +0 -3
- package/dist/components/core/Card/CardDescription.js +0 -11
- package/dist/components/core/DescriptionList/DescriptionList.theme.js +0 -8
- 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.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/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/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.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
|
@@ -1,43 +1,67 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import React__default, { useId, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { checkboxTheme } from './Checkbox.theme.js';
|
|
4
|
-
import {
|
|
4
|
+
import { formLabelTheme } from '../FormLabel/FormLabel.theme.js';
|
|
5
5
|
import { MinusIcon, CheckIcon } from '@heroicons/react/24/outline';
|
|
6
6
|
import { cn } from '../../../utils/cn.js';
|
|
7
|
+
import { useCheckboxGroupContext } from './CheckboxContext.js';
|
|
8
|
+
import { CheckboxGroup } from './CheckboxGroup.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Checkbox component for selecting one or more options
|
|
10
12
|
*/
|
|
11
|
-
const
|
|
13
|
+
const CheckboxComponent = React__default.forwardRef(({ id: idProp, name: nameProp, value, checked: controlledChecked, indeterminate = false, onChange, label, description, state: stateProp = "default", size: sizeProp = "md", className, ...restProps }, ref) => {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const autoId = useId();
|
|
16
|
+
const groupContext = useCheckboxGroupContext();
|
|
17
|
+
// Resolve props from group context or individual props
|
|
18
|
+
const id = idProp !== null && idProp !== void 0 ? idProp : autoId;
|
|
19
|
+
const name = (_b = (_a = groupContext === null || groupContext === void 0 ? void 0 : groupContext.name) !== null && _a !== void 0 ? _a : nameProp) !== null && _b !== void 0 ? _b : autoId;
|
|
20
|
+
const size = (_c = groupContext === null || groupContext === void 0 ? void 0 : groupContext.size) !== null && _c !== void 0 ? _c : sizeProp;
|
|
21
|
+
const state = stateProp === "disabled" ? "disabled" : ((_d = groupContext === null || groupContext === void 0 ? void 0 : groupContext.state) !== null && _d !== void 0 ? _d : stateProp);
|
|
22
|
+
const isDisabled = state === "disabled";
|
|
23
|
+
// Determine checked state
|
|
24
|
+
const isInGroup = groupContext !== undefined;
|
|
12
25
|
const [internalChecked, setInternalChecked] = useState(false);
|
|
26
|
+
let isChecked;
|
|
27
|
+
if (isInGroup) {
|
|
28
|
+
isChecked = groupContext.value.includes(value);
|
|
29
|
+
}
|
|
30
|
+
else if (controlledChecked !== undefined) {
|
|
31
|
+
isChecked = controlledChecked;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
isChecked = internalChecked;
|
|
35
|
+
}
|
|
13
36
|
const inputRef = useRef(null);
|
|
14
|
-
// Determine if component is controlled or uncontrolled
|
|
15
|
-
const isControlled = controlledChecked !== undefined;
|
|
16
|
-
const isChecked = isControlled ? controlledChecked : internalChecked;
|
|
17
37
|
// Set indeterminate property on the input element
|
|
18
38
|
useEffect(() => {
|
|
19
39
|
if (inputRef.current) {
|
|
20
40
|
inputRef.current.indeterminate = indeterminate;
|
|
21
41
|
}
|
|
22
42
|
}, [indeterminate]);
|
|
23
|
-
// Derive state flags
|
|
24
|
-
const isDisabled = state === "disabled";
|
|
25
43
|
const handleChange = (e) => {
|
|
26
44
|
if (isDisabled)
|
|
27
45
|
return;
|
|
28
|
-
if (
|
|
46
|
+
if (isInGroup) {
|
|
47
|
+
groupContext.onChange(value, e.target.checked);
|
|
48
|
+
}
|
|
49
|
+
else if (controlledChecked === undefined) {
|
|
29
50
|
setInternalChecked(e.target.checked);
|
|
30
51
|
}
|
|
31
52
|
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked, value);
|
|
32
53
|
};
|
|
33
54
|
return (jsxs("div", { className: cn(checkboxTheme.baseStyle, className), ...restProps, children: [jsxs("div", { className: cn(checkboxTheme.inputContainerStyle, checkboxTheme.sizes[size]), children: [jsx("input", { ref: (node) => {
|
|
34
55
|
inputRef.current = node;
|
|
35
|
-
if (typeof ref ===
|
|
56
|
+
if (typeof ref === "function")
|
|
36
57
|
ref(node);
|
|
37
58
|
else if (ref)
|
|
38
59
|
ref.current = node;
|
|
39
|
-
}, type: "checkbox", id: id, name: name, value: value, checked: isChecked, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "data-state": isDisabled ? "disabled" : "default", className: cn(checkboxTheme.inputStyle, checkboxTheme.sizes[size], indeterminate && "bg-neutral-200") }), indeterminate && (jsx(MinusIcon, { className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center opacity-100 stroke-neutral-600 transition-opacity duration-200", size === "sm" ? "size-3" : "size-4"), strokeWidth: 3 })), isChecked && !indeterminate && (jsx(CheckIcon, { className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center opacity-100 stroke-white transition-opacity duration-200", size === "sm" ? "size-3" : "size-4"), strokeWidth: 3 }))] }), (label || description) && (jsxs("
|
|
60
|
+
}, type: "checkbox", id: id, name: name, value: value, checked: isChecked, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "data-state": isDisabled ? "disabled" : "default", className: cn(checkboxTheme.inputStyle, checkboxTheme.sizes[size], indeterminate && "bg-neutral-200") }), indeterminate && (jsx(MinusIcon, { className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center opacity-100 stroke-neutral-600 transition-opacity duration-200", size === "sm" ? "size-3" : "size-4"), strokeWidth: 3 })), isChecked && !indeterminate && (jsx(CheckIcon, { className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center opacity-100 stroke-white transition-opacity duration-200", size === "sm" ? "size-3" : "size-4"), strokeWidth: 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: checkboxTheme.descriptionStyle, children: description }))] }))] }));
|
|
61
|
+
});
|
|
62
|
+
CheckboxComponent.displayName = "Checkbox";
|
|
63
|
+
const Checkbox = Object.assign(CheckboxComponent, {
|
|
64
|
+
Group: CheckboxGroup,
|
|
40
65
|
});
|
|
41
|
-
Checkbox.displayName = "Checkbox";
|
|
42
66
|
|
|
43
67
|
export { Checkbox };
|
|
@@ -8,9 +8,9 @@ const checkboxTheme = {
|
|
|
8
8
|
// Input styles with light and dark mode variants
|
|
9
9
|
inputStyle: "col-start-1 row-start-1 appearance-none rounded-[calc(var(--radius-base)*0.75)] border-2 transition-all duration-400 " +
|
|
10
10
|
// Default state - light
|
|
11
|
-
"border-[var(--color-border)] bg-[var(--color-
|
|
11
|
+
"border-[var(--color-border)] bg-[var(--color-surface)] " +
|
|
12
12
|
// Default state - dark
|
|
13
|
-
" " +
|
|
13
|
+
"dark:bg-[var(--color-background-secondary)] " +
|
|
14
14
|
// Checked state - light
|
|
15
15
|
"checked:border-[var(--color-primary)] checked:bg-[var(--color-primary)] " +
|
|
16
16
|
// Checked state - dark
|
|
@@ -30,13 +30,17 @@ const checkboxTheme = {
|
|
|
30
30
|
"dark:disabled:bg-[var(--color-neutral-700)] dark:disabled:border-[var(--color-neutral-600)] " +
|
|
31
31
|
"dark:data-[state=disabled]:bg-[var(--color-neutral-700)] dark:data-[state=disabled]:border-[var(--color-neutral-600)]",
|
|
32
32
|
// Description text - light and dark
|
|
33
|
-
descriptionStyle: "text-
|
|
34
|
-
"text-[var(--color-text-secondary)] " +
|
|
35
|
-
"dark:text-[var(--color-neutral-400)]",
|
|
33
|
+
descriptionStyle: "text-base mt-0.5 " + "text-[var(--color-text-secondary)]/80 " + " ",
|
|
36
34
|
sizes: {
|
|
37
35
|
sm: "size-5 mt-0.25",
|
|
38
36
|
md: "size-6",
|
|
39
37
|
},
|
|
38
|
+
// Group styles
|
|
39
|
+
groupStyle: "flex flex-col gap-1.5",
|
|
40
|
+
groupHorizontalStyle: "flex-row flex-wrap gap-x-6 gap-y-3",
|
|
41
|
+
groupDescriptionStyle: "text-base text-[var(--color-text-secondary)]/80 -mt-0.5 mb-1",
|
|
42
|
+
groupErrorStyle: "text-base text-[var(--color-danger)] mt-1.5",
|
|
43
|
+
groupItemsStyle: "flex flex-col gap-3",
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
export { checkboxTheme };
|
|
@@ -7,12 +7,16 @@ export type CheckboxState = 'default' | 'disabled';
|
|
|
7
7
|
* Size variants for the checkbox component
|
|
8
8
|
*/
|
|
9
9
|
export type CheckboxSize = 'sm' | 'md';
|
|
10
|
+
/**
|
|
11
|
+
* Orientation for Checkbox.Group layout
|
|
12
|
+
*/
|
|
13
|
+
export type CheckboxGroupOrientation = 'vertical' | 'horizontal';
|
|
10
14
|
/**
|
|
11
15
|
* Checkbox component props
|
|
12
16
|
*/
|
|
13
17
|
export interface CheckboxProps extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange' | 'size'> {
|
|
14
|
-
id
|
|
15
|
-
name
|
|
18
|
+
id?: string;
|
|
19
|
+
name?: string;
|
|
16
20
|
value: string;
|
|
17
21
|
checked?: boolean;
|
|
18
22
|
indeterminate?: boolean;
|
|
@@ -23,6 +27,23 @@ export interface CheckboxProps extends Omit<React.HTMLAttributes<HTMLInputElemen
|
|
|
23
27
|
size?: CheckboxSize;
|
|
24
28
|
className?: string;
|
|
25
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Checkbox.Group component props
|
|
32
|
+
*/
|
|
33
|
+
export interface CheckboxGroupProps extends Omit<React.HTMLAttributes<HTMLFieldSetElement>, 'onChange'> {
|
|
34
|
+
value?: string[];
|
|
35
|
+
defaultValue?: string[];
|
|
36
|
+
onChange?: (value: string[]) => void;
|
|
37
|
+
name?: string;
|
|
38
|
+
size?: CheckboxSize;
|
|
39
|
+
state?: CheckboxState;
|
|
40
|
+
orientation?: CheckboxGroupOrientation;
|
|
41
|
+
label?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
required?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
26
47
|
/**
|
|
27
48
|
* Checkbox theme configuration
|
|
28
49
|
*/
|
|
@@ -32,4 +53,9 @@ export interface CheckboxTheme {
|
|
|
32
53
|
inputStyle: string;
|
|
33
54
|
descriptionStyle: string;
|
|
34
55
|
sizes: Record<CheckboxSize, string>;
|
|
56
|
+
groupStyle?: string;
|
|
57
|
+
groupHorizontalStyle?: string;
|
|
58
|
+
groupDescriptionStyle?: string;
|
|
59
|
+
groupErrorStyle?: string;
|
|
60
|
+
groupItemsStyle?: string;
|
|
35
61
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CheckboxSize, CheckboxState } from "./Checkbox.types";
|
|
2
|
+
export interface CheckboxGroupContextValue {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string[];
|
|
5
|
+
onChange: (itemValue: string, checked: boolean) => void;
|
|
6
|
+
size: CheckboxSize;
|
|
7
|
+
state: CheckboxState;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckboxGroupContext: import("react").Context<CheckboxGroupContextValue | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the group context, or undefined when used outside a Checkbox.Group.
|
|
12
|
+
* This allows standalone Checkbox usage without a Group wrapper.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useCheckboxGroupContext(): CheckboxGroupContextValue | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const CheckboxGroupContext = createContext(undefined);
|
|
4
|
+
/**
|
|
5
|
+
* Returns the group context, or undefined when used outside a Checkbox.Group.
|
|
6
|
+
* This allows standalone Checkbox usage without a Group wrapper.
|
|
7
|
+
*/
|
|
8
|
+
function useCheckboxGroupContext() {
|
|
9
|
+
return useContext(CheckboxGroupContext);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { CheckboxGroupContext, useCheckboxGroupContext };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useId, useState, useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { checkboxTheme } from './Checkbox.theme.js';
|
|
5
|
+
import { formLabelTheme } from '../FormLabel/FormLabel.theme.js';
|
|
6
|
+
import { CheckboxGroupContext } from './CheckboxContext.js';
|
|
7
|
+
|
|
8
|
+
const CheckboxGroup = React__default.forwardRef(({ value: controlledValue, defaultValue, onChange, name, size = "md", state = "default", orientation = "vertical", label, description, error, required, className, children, ...props }, ref) => {
|
|
9
|
+
const autoId = useId();
|
|
10
|
+
const groupName = name !== null && name !== void 0 ? name : `checkbox-group-${autoId}`;
|
|
11
|
+
const labelId = `${autoId}-label`;
|
|
12
|
+
const descriptionId = `${autoId}-desc`;
|
|
13
|
+
const errorId = `${autoId}-error`;
|
|
14
|
+
// Controlled vs uncontrolled
|
|
15
|
+
const isControlled = controlledValue !== undefined;
|
|
16
|
+
const [internalValue, setInternalValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : []);
|
|
17
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
18
|
+
const handleChange = (itemValue, checked) => {
|
|
19
|
+
const next = checked
|
|
20
|
+
? [...currentValue, itemValue]
|
|
21
|
+
: currentValue.filter((v) => v !== itemValue);
|
|
22
|
+
if (!isControlled) {
|
|
23
|
+
setInternalValue(next);
|
|
24
|
+
}
|
|
25
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(next);
|
|
26
|
+
};
|
|
27
|
+
const contextValue = useMemo(() => ({
|
|
28
|
+
name: groupName,
|
|
29
|
+
value: currentValue,
|
|
30
|
+
onChange: handleChange,
|
|
31
|
+
size,
|
|
32
|
+
state,
|
|
33
|
+
}), [groupName, currentValue, size, state]);
|
|
34
|
+
const labelState = error ? "invalid" : state === "disabled" ? "disabled" : "default";
|
|
35
|
+
return (jsx(CheckboxGroupContext.Provider, { value: contextValue, children: jsxs("fieldset", { ref: ref, role: "group", "aria-labelledby": label ? labelId : undefined, "aria-describedby": description ? descriptionId : undefined, "aria-required": required || undefined, "aria-invalid": error ? true : undefined, "aria-errormessage": error ? errorId : undefined, className: cn("border-0 p-0 m-0", checkboxTheme.groupStyle, className), ...props, children: [label && (jsxs("legend", { id: labelId, className: cn(formLabelTheme.baseStyle, formLabelTheme.stateStyles[labelState]), children: [label, required && (jsx("span", { className: formLabelTheme.requiredIndicatorStyle, children: "*" }))] })), description && (jsx("p", { id: descriptionId, className: checkboxTheme.groupDescriptionStyle, children: description })), jsx("div", { className: cn(checkboxTheme.groupItemsStyle, orientation === "horizontal" &&
|
|
36
|
+
checkboxTheme.groupHorizontalStyle), children: children }), error && (jsx("p", { id: errorId, role: "alert", className: checkboxTheme.groupErrorStyle, children: error }))] }) }));
|
|
37
|
+
});
|
|
38
|
+
CheckboxGroup.displayName = "Checkbox.Group";
|
|
39
|
+
|
|
40
|
+
export { CheckboxGroup };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Checkbox } from './Checkbox';
|
|
2
|
-
export type { CheckboxProps, CheckboxSize, CheckboxState } from './Checkbox.types';
|
|
2
|
+
export type { CheckboxProps, CheckboxSize, CheckboxState, CheckboxGroupProps, CheckboxGroupOrientation } from './Checkbox.types';
|
|
3
3
|
export { checkboxTheme } from './Checkbox.theme';
|
|
@@ -152,7 +152,7 @@ const ColorPickerRoot = React__default.forwardRef(({ value, defaultValue = '#000
|
|
|
152
152
|
getFormattedValue,
|
|
153
153
|
onChange,
|
|
154
154
|
]);
|
|
155
|
-
return (jsx(ColorPickerContext.Provider, { value: contextValue, children: jsxs("div", { ref: ref, className: cn(mergedTheme.baseStyle, className), ...props, children: [label && (jsx(FormLabel, { htmlFor: "color-picker", required: required, state: state, children: label })), children, helperText && (jsx("div", { className: cn('mt-1.5 text-
|
|
155
|
+
return (jsx(ColorPickerContext.Provider, { value: contextValue, children: jsxs("div", { ref: ref, className: cn(mergedTheme.baseStyle, className), ...props, children: [label && (jsx(FormLabel, { htmlFor: "color-picker", required: required, state: state, children: label })), children, helperText && (jsx("div", { className: cn('mt-1.5 text-sm text-[var(--color-text-secondary)]', state === 'invalid' && 'text-[var(--color-danger)]'), children: helperText }))] }) }));
|
|
156
156
|
});
|
|
157
157
|
ColorPickerRoot.displayName = 'ColorPicker';
|
|
158
158
|
/**
|
|
@@ -7,12 +7,12 @@ const colorPickerTheme = {
|
|
|
7
7
|
triggerStyle: 'cursor-pointer',
|
|
8
8
|
swatchStyle: 'relative size-5 flex-shrink-0 rounded border border-[var(--color-border)] overflow-hidden',
|
|
9
9
|
// Content matches Dropdown menu style
|
|
10
|
-
contentStyle: 'min-w-[280px] max-w-[320px] rounded-xl border border-[var(--color-border)] bg-white shadow-real-xl p-3 focus:outline-none',
|
|
10
|
+
contentStyle: 'min-w-[min(280px,calc(100vw-2rem))] max-w-[320px] rounded-xl border border-[var(--color-border)] bg-white shadow-real-xl p-3 focus:outline-none',
|
|
11
11
|
sliderContainerStyle: 'space-y-2',
|
|
12
|
-
sliderLabelStyle: 'flex items-center justify-between text-
|
|
12
|
+
sliderLabelStyle: 'flex items-center justify-between text-sm font-medium text-[var(--color-text-secondary)]',
|
|
13
13
|
inputContainerStyle: 'flex items-center gap-2',
|
|
14
14
|
formatSelectorStyle: 'flex-shrink-0',
|
|
15
|
-
presetGridStyle: 'mt-3 grid grid-cols-8 gap-1.5',
|
|
15
|
+
presetGridStyle: 'mt-3 grid grid-cols-6 sm:grid-cols-8 gap-1.5',
|
|
16
16
|
presetSwatchStyle: 'relative size-7 cursor-pointer rounded border-2 border-transparent transition-all hover:border-[var(--color-primary)] hover:scale-110 focus:border-[var(--color-primary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:ring-opacity-20 data-[selected]:border-[var(--color-primary)] data-[selected]:ring-2 data-[selected]:ring-[var(--color-primary)] data-[selected]:ring-opacity-20',
|
|
17
17
|
eyedropperButtonStyle: 'flex-shrink-0',
|
|
18
18
|
};
|
|
@@ -45,7 +45,7 @@ const ColorPickerInput = ({ className, ...props }) => {
|
|
|
45
45
|
};
|
|
46
46
|
// Render different input types based on format
|
|
47
47
|
if (format === "hex") {
|
|
48
|
-
return (jsx("div", { className: cn(theme.inputContainerStyle, className), ...props, children: jsx(Input, { type: "text", size: "sm", value: inputValue, onChange: handleChange, onBlur: handleBlur, onKeyDown: handleKeyDown, state: isInvalid ? "invalid" : "default", placeholder: "#000000", className: "flex-1 text-
|
|
48
|
+
return (jsx("div", { className: cn(theme.inputContainerStyle, className), ...props, children: jsx(Input, { type: "text", size: "sm", value: inputValue, onChange: handleChange, onBlur: handleBlur, onKeyDown: handleKeyDown, state: isInvalid ? "invalid" : "default", placeholder: "#000000", className: "flex-1 text-base font-mono", "aria-label": "Hex color value" }) }));
|
|
49
49
|
}
|
|
50
50
|
if (format === "rgb") {
|
|
51
51
|
const rgb = hslToRgb(color.h, color.s, color.l);
|
|
@@ -56,21 +56,21 @@ const ColorPickerInput = ({ className, ...props }) => {
|
|
|
56
56
|
if (parsed)
|
|
57
57
|
setColor(parsed);
|
|
58
58
|
}
|
|
59
|
-
}, className: "flex-1 text-
|
|
59
|
+
}, className: "flex-1 text-base", "aria-label": "Red", placeholder: "R" }), jsx(Input, { type: "number", size: "sm", min: 0, max: 255, value: rgb.g, onChange: (e) => {
|
|
60
60
|
const newG = parseInt(e.target.value, 10);
|
|
61
61
|
if (!isNaN(newG) && newG >= 0 && newG <= 255) {
|
|
62
62
|
const parsed = parseColor(`rgb(${rgb.r}, ${newG}, ${rgb.b})`);
|
|
63
63
|
if (parsed)
|
|
64
64
|
setColor(parsed);
|
|
65
65
|
}
|
|
66
|
-
}, className: "flex-1 text-
|
|
66
|
+
}, className: "flex-1 text-base", "aria-label": "Green", placeholder: "G" }), jsx(Input, { type: "number", size: "sm", min: 0, max: 255, value: rgb.b, onChange: (e) => {
|
|
67
67
|
const newB = parseInt(e.target.value, 10);
|
|
68
68
|
if (!isNaN(newB) && newB >= 0 && newB <= 255) {
|
|
69
69
|
const parsed = parseColor(`rgb(${rgb.r}, ${rgb.g}, ${newB})`);
|
|
70
70
|
if (parsed)
|
|
71
71
|
setColor(parsed);
|
|
72
72
|
}
|
|
73
|
-
}, className: "flex-1 text-
|
|
73
|
+
}, className: "flex-1 text-base", "aria-label": "Blue", placeholder: "B" })] }));
|
|
74
74
|
}
|
|
75
75
|
if (format === "hsl") {
|
|
76
76
|
return (jsxs("div", { className: cn(theme.inputContainerStyle, "flex gap-2", className), ...props, children: [jsx(Input, { type: "number", size: "sm", min: 0, max: 360, value: Math.round(color.h), onChange: (e) => {
|
|
@@ -78,17 +78,17 @@ const ColorPickerInput = ({ className, ...props }) => {
|
|
|
78
78
|
if (!isNaN(newH) && newH >= 0 && newH <= 360) {
|
|
79
79
|
setColor({ ...color, h: newH });
|
|
80
80
|
}
|
|
81
|
-
}, className: "flex-1 text-
|
|
81
|
+
}, className: "flex-1 text-base", "aria-label": "Hue", placeholder: "H" }), jsx(Input, { type: "number", size: "sm", min: 0, max: 100, value: Math.round(color.s), onChange: (e) => {
|
|
82
82
|
const newS = parseInt(e.target.value, 10);
|
|
83
83
|
if (!isNaN(newS) && newS >= 0 && newS <= 100) {
|
|
84
84
|
setColor({ ...color, s: newS });
|
|
85
85
|
}
|
|
86
|
-
}, className: "flex-1 text-
|
|
86
|
+
}, className: "flex-1 text-base", "aria-label": "Saturation", placeholder: "S" }), jsx(Input, { type: "number", size: "sm", min: 0, max: 100, value: Math.round(color.l), onChange: (e) => {
|
|
87
87
|
const newL = parseInt(e.target.value, 10);
|
|
88
88
|
if (!isNaN(newL) && newL >= 0 && newL <= 100) {
|
|
89
89
|
setColor({ ...color, l: newL });
|
|
90
90
|
}
|
|
91
|
-
}, className: "flex-1 text-
|
|
91
|
+
}, className: "flex-1 text-base", "aria-label": "Lightness", placeholder: "L" })] }));
|
|
92
92
|
}
|
|
93
93
|
return null;
|
|
94
94
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useId, useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
+
import { cronInputTheme } from './CronInput.theme.js';
|
|
4
|
+
import { parseCron, validateCron, cronToDescription, getNextRuns, CRON_PRESETS, getMinuteOptions, getHourOptions, getDayOfMonthOptions, getMonthOptions, getDayOfWeekOptions, formatNextRun, fieldsToCron } from './CronInput.utils.js';
|
|
5
|
+
import { FormLabel } from '../FormLabel/FormLabel.js';
|
|
6
|
+
import { cn } from '../../../utils/cn.js';
|
|
7
|
+
import { CalendarIcon, ClockIcon } from '@heroicons/react/24/outline';
|
|
8
|
+
|
|
9
|
+
const FieldSelect = ({ label, value, options, onChange, disabled, size = "md", className, }) => {
|
|
10
|
+
const theme = cronInputTheme;
|
|
11
|
+
return (jsxs("div", { className: theme.fieldGroupStyle, children: [jsx("label", { className: theme.fieldLabelStyle, children: label }), jsx("select", { value: value, onChange: (e) => onChange(e.target.value), disabled: disabled, className: cn(theme.fieldSelectStyle, theme.fieldSelectSizes[size], className), "aria-label": `Cron ${label.toLowerCase()} field`, children: options.map((option) => (jsx("option", { value: option.value, children: option.label }, option.value))) })] }));
|
|
12
|
+
};
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Main CronInput Component
|
|
15
|
+
// ============================================================================
|
|
16
|
+
const CronInput = React__default.forwardRef(({ value: controlledValue, defaultValue = "* * * * *", onChange, showPresets = true, showDescription = true, showNextRuns = true, nextRunCount = 3, size = "md", mode = "both", className, theme: themeOverrides, disabled = false, label, ...props }, ref) => {
|
|
17
|
+
// Unique ID for accessibility
|
|
18
|
+
const generatedId = useId();
|
|
19
|
+
// Controlled vs uncontrolled state
|
|
20
|
+
const isControlled = controlledValue !== undefined;
|
|
21
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
22
|
+
const cronValue = isControlled ? controlledValue : internalValue;
|
|
23
|
+
// Active mode when mode="both"
|
|
24
|
+
const [activeMode, setActiveMode] = useState(mode === "both" ? "visual" : mode);
|
|
25
|
+
// Raw input state (tracks what user is typing, may be invalid temporarily)
|
|
26
|
+
const [rawInput, setRawInput] = useState(cronValue);
|
|
27
|
+
// Sync raw input when controlled value changes
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (isControlled) {
|
|
30
|
+
setRawInput(controlledValue);
|
|
31
|
+
}
|
|
32
|
+
}, [controlledValue, isControlled]);
|
|
33
|
+
// Merge theme with overrides
|
|
34
|
+
const theme = useMemo(() => ({
|
|
35
|
+
...cronInputTheme,
|
|
36
|
+
...themeOverrides,
|
|
37
|
+
}), [themeOverrides]);
|
|
38
|
+
// Parse current cron value into fields
|
|
39
|
+
const fields = useMemo(() => parseCron(cronValue), [cronValue]);
|
|
40
|
+
// Validation state
|
|
41
|
+
const isValid = useMemo(() => validateCron(cronValue), [cronValue]);
|
|
42
|
+
// Human-readable description
|
|
43
|
+
const description = useMemo(() => (isValid ? cronToDescription(cronValue) : ""), [cronValue, isValid]);
|
|
44
|
+
// Next run times
|
|
45
|
+
const nextRuns = useMemo(() => (isValid && showNextRuns ? getNextRuns(cronValue, nextRunCount) : []), [cronValue, isValid, showNextRuns, nextRunCount]);
|
|
46
|
+
// Active preset detection
|
|
47
|
+
const activePreset = useMemo(() => { var _a, _b; return (_b = (_a = CRON_PRESETS.find((p) => p.value === cronValue)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null; }, [cronValue]);
|
|
48
|
+
// Memoized options
|
|
49
|
+
const minuteOptions = useMemo(() => getMinuteOptions(), []);
|
|
50
|
+
const hourOptions = useMemo(() => getHourOptions(), []);
|
|
51
|
+
const dayOfMonthOptions = useMemo(() => getDayOfMonthOptions(), []);
|
|
52
|
+
const monthOptions = useMemo(() => getMonthOptions(), []);
|
|
53
|
+
const dayOfWeekOptions = useMemo(() => getDayOfWeekOptions(), []);
|
|
54
|
+
// Update the cron value
|
|
55
|
+
const updateValue = useCallback((newCron) => {
|
|
56
|
+
if (!isControlled) {
|
|
57
|
+
setInternalValue(newCron);
|
|
58
|
+
}
|
|
59
|
+
setRawInput(newCron);
|
|
60
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newCron);
|
|
61
|
+
}, [isControlled, onChange]);
|
|
62
|
+
// Handle field change from visual builder
|
|
63
|
+
const handleFieldChange = useCallback((field, newFieldValue) => {
|
|
64
|
+
const newFields = { ...fields, [field]: newFieldValue };
|
|
65
|
+
const newCron = fieldsToCron(newFields);
|
|
66
|
+
updateValue(newCron);
|
|
67
|
+
}, [fields, updateValue]);
|
|
68
|
+
// Handle raw input change
|
|
69
|
+
const handleRawInputChange = useCallback((e) => {
|
|
70
|
+
const newRaw = e.target.value;
|
|
71
|
+
setRawInput(newRaw);
|
|
72
|
+
if (validateCron(newRaw)) {
|
|
73
|
+
if (!isControlled) {
|
|
74
|
+
setInternalValue(newRaw);
|
|
75
|
+
}
|
|
76
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newRaw);
|
|
77
|
+
}
|
|
78
|
+
}, [isControlled, onChange]);
|
|
79
|
+
// Handle raw input blur - commit value if valid
|
|
80
|
+
const handleRawInputBlur = useCallback(() => {
|
|
81
|
+
if (validateCron(rawInput)) {
|
|
82
|
+
updateValue(rawInput);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Reset to last valid value
|
|
86
|
+
setRawInput(cronValue);
|
|
87
|
+
}
|
|
88
|
+
}, [rawInput, cronValue, updateValue]);
|
|
89
|
+
// Handle preset click
|
|
90
|
+
const handlePresetClick = useCallback((presetValue) => {
|
|
91
|
+
if (disabled)
|
|
92
|
+
return;
|
|
93
|
+
updateValue(presetValue);
|
|
94
|
+
}, [disabled, updateValue]);
|
|
95
|
+
// Handle Enter key in raw input
|
|
96
|
+
const handleRawKeyDown = useCallback((e) => {
|
|
97
|
+
if (e.key === "Enter") {
|
|
98
|
+
handleRawInputBlur();
|
|
99
|
+
}
|
|
100
|
+
}, [handleRawInputBlur]);
|
|
101
|
+
const showVisual = mode === "visual" || (mode === "both" && activeMode === "visual");
|
|
102
|
+
const showRaw = mode === "raw" || (mode === "both" && activeMode === "raw");
|
|
103
|
+
return (jsxs("div", { ref: ref, className: cn(theme.baseStyle, className), role: "group", "aria-label": label || "Cron expression builder", ...props, children: [label && (jsx(FormLabel, { htmlFor: `${generatedId}-cron`, state: disabled ? "disabled" : "default", children: label })), mode === "both" && (jsxs("div", { className: "flex items-center gap-1.5", children: [jsxs("button", { type: "button", onClick: () => setActiveMode("visual"), disabled: disabled, className: cn(theme.modeToggleStyle, activeMode === "visual" && theme.modeToggleActiveStyle), "aria-pressed": activeMode === "visual", children: [jsx(CalendarIcon, { className: "w-3.5 h-3.5 mr-1", "aria-hidden": "true" }), "Visual"] }), jsxs("button", { type: "button", onClick: () => setActiveMode("raw"), disabled: disabled, className: cn(theme.modeToggleStyle, activeMode === "raw" && theme.modeToggleActiveStyle), "aria-pressed": activeMode === "raw", children: [jsx(ClockIcon, { className: "w-3.5 h-3.5 mr-1", "aria-hidden": "true" }), "Cron"] })] })), showPresets && (jsxs("div", { children: [jsx("div", { className: cn(theme.sectionHeadingStyle, "mb-1.5"), children: "Presets" }), jsx("div", { className: "flex flex-wrap gap-1.5", children: CRON_PRESETS.map((preset) => (jsx("button", { type: "button", onClick: () => handlePresetClick(preset.value), disabled: disabled, className: cn(theme.presetButtonStyle, activePreset === preset.value && theme.presetButtonActiveStyle), title: preset.description, "aria-pressed": activePreset === preset.value, children: preset.label }, preset.value))) })] })), showVisual && (jsxs("div", { className: theme.builderStyle, children: [jsx(FieldSelect, { label: "Minute", value: fields.minute, options: minuteOptions, onChange: (v) => handleFieldChange("minute", v), disabled: disabled, size: size }), jsx(FieldSelect, { label: "Hour", value: fields.hour, options: hourOptions, onChange: (v) => handleFieldChange("hour", v), disabled: disabled, size: size }), jsx(FieldSelect, { label: "Day of Month", value: fields.dayOfMonth, options: dayOfMonthOptions, onChange: (v) => handleFieldChange("dayOfMonth", v), disabled: disabled, size: size }), jsx(FieldSelect, { label: "Month", value: fields.month, options: monthOptions, onChange: (v) => handleFieldChange("month", v), disabled: disabled, size: size }), jsx(FieldSelect, { label: "Day of Week", value: fields.dayOfWeek, options: dayOfWeekOptions, onChange: (v) => handleFieldChange("dayOfWeek", v), disabled: disabled, size: size })] })), showRaw && (jsxs("div", { children: [jsx("div", { className: cn(theme.sectionHeadingStyle, "mb-1.5"), children: "Cron Expression" }), jsx("input", { type: "text", value: rawInput, onChange: handleRawInputChange, onBlur: handleRawInputBlur, onKeyDown: handleRawKeyDown, disabled: disabled, placeholder: "* * * * *", className: cn(theme.rawInputStyle, theme.rawInputSizes[size]), id: `${generatedId}-cron`, "aria-label": "Cron expression", "aria-invalid": !validateCron(rawInput), spellCheck: false, autoComplete: "off" }), !validateCron(rawInput) && rawInput !== cronValue && (jsx("div", { className: cn(theme.errorStyle, "mt-1"), children: "Invalid cron expression. Format: minute hour day month weekday" }))] })), showVisual && !showRaw && (jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: cn(theme.fieldLabelStyle, "shrink-0"), children: "Expression:" }), jsx("code", { className: cn("font-mono text-sm px-2 py-1 rounded-[var(--form-radius)]", "bg-[var(--color-background-secondary)] text-[var(--color-text-primary)]", "dark:bg-[var(--color-neutral-800)] dark:text-[var(--color-neutral-200)]"), children: cronValue })] })), showDescription && isValid && (jsxs("div", { className: theme.descriptionStyle, children: [jsx(ClockIcon, { className: "w-4 h-4 shrink-0", "aria-hidden": "true" }), jsx("span", { children: description })] })), showNextRuns && isValid && nextRuns.length > 0 && (jsxs("div", { className: theme.nextRunsStyle, children: [jsx("div", { className: cn(theme.sectionHeadingStyle, "mb-1"), children: "Next runs" }), nextRuns.map((date, index) => (jsxs("div", { className: theme.nextRunItemStyle, children: [jsx(CalendarIcon, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }), jsx("span", { children: formatNextRun(date) })] }, index)))] }))] }));
|
|
104
|
+
});
|
|
105
|
+
CronInput.displayName = "CronInput";
|
|
106
|
+
|
|
107
|
+
export { CronInput };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { formsBaseTheme } from '../forms.theme.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default theme for the CronInput component
|
|
5
|
+
* Uses flat structure with CSS variable design tokens
|
|
6
|
+
*/
|
|
7
|
+
const cronInputTheme = {
|
|
8
|
+
// Outer wrapper
|
|
9
|
+
baseStyle: "relative w-full flex flex-col gap-3",
|
|
10
|
+
// Label
|
|
11
|
+
labelStyle: "text-base font-medium text-[var(--color-text-primary)] dark:text-[var(--color-neutral-200)]",
|
|
12
|
+
// Visual builder grid
|
|
13
|
+
builderStyle: "grid grid-cols-5 gap-2",
|
|
14
|
+
// Individual field group
|
|
15
|
+
fieldGroupStyle: "flex flex-col gap-1",
|
|
16
|
+
// Field label
|
|
17
|
+
fieldLabelStyle: "text-sm font-medium text-[var(--color-text-secondary)] dark:text-[var(--color-neutral-400)]",
|
|
18
|
+
// Select dropdown
|
|
19
|
+
fieldSelectStyle: "w-full rounded-[var(--form-radius)] outline outline-1 outline-[var(--color-border)] " +
|
|
20
|
+
"bg-white text-[var(--color-text-primary)] cursor-pointer transition-all " +
|
|
21
|
+
"focus:outline-2 focus:outline-[var(--color-primary-600)] focus:-outline-offset-1 " +
|
|
22
|
+
"focus:ring-4 focus:ring-[var(--color-primary)]/10 " +
|
|
23
|
+
"disabled:cursor-not-allowed disabled:bg-[var(--color-background-disabled)] disabled:text-[var(--color-text-disabled)] " +
|
|
24
|
+
"dark:bg-[var(--color-neutral-900)] dark:outline-[var(--color-neutral-700)] dark:text-[var(--color-neutral-200)] " +
|
|
25
|
+
"dark:focus:outline-[var(--color-primary-500)] dark:focus:ring-[var(--color-primary-500)]/20",
|
|
26
|
+
// Size variants for field selects
|
|
27
|
+
fieldSelectSizes: {
|
|
28
|
+
sm: `${formsBaseTheme.sizes.sm.text} ${formsBaseTheme.sizes.sm.padding} ${formsBaseTheme.sizes.sm.height}`,
|
|
29
|
+
md: `${formsBaseTheme.sizes.md.text} ${formsBaseTheme.sizes.md.padding} ${formsBaseTheme.sizes.md.height}`,
|
|
30
|
+
lg: `${formsBaseTheme.sizes.lg.text} ${formsBaseTheme.sizes.lg.padding} ${formsBaseTheme.sizes.lg.height}`,
|
|
31
|
+
},
|
|
32
|
+
// Raw input field
|
|
33
|
+
rawInputStyle: "w-full rounded-[var(--form-radius)] outline outline-1 outline-[var(--color-border)] " +
|
|
34
|
+
"bg-white text-[var(--color-text-primary)] font-mono transition-all " +
|
|
35
|
+
"placeholder:text-[var(--color-text-placeholder)] focus:outline-none " +
|
|
36
|
+
"focus:outline-2 focus:outline-[var(--color-primary-600)] focus:-outline-offset-1 " +
|
|
37
|
+
"focus:ring-4 focus:ring-[var(--color-primary)]/10 " +
|
|
38
|
+
"disabled:cursor-not-allowed disabled:bg-[var(--color-background-disabled)] disabled:text-[var(--color-text-disabled)] " +
|
|
39
|
+
"dark:bg-[var(--color-neutral-900)] dark:outline-[var(--color-neutral-700)] dark:text-[var(--color-neutral-200)] " +
|
|
40
|
+
"dark:focus:outline-[var(--color-primary-500)] dark:focus:ring-[var(--color-primary-500)]/20",
|
|
41
|
+
// Size variants for raw input
|
|
42
|
+
rawInputSizes: {
|
|
43
|
+
sm: `${formsBaseTheme.sizes.sm.text} ${formsBaseTheme.sizes.sm.padding} ${formsBaseTheme.sizes.sm.height}`,
|
|
44
|
+
md: `${formsBaseTheme.sizes.md.text} ${formsBaseTheme.sizes.md.padding} ${formsBaseTheme.sizes.md.height}`,
|
|
45
|
+
lg: `${formsBaseTheme.sizes.lg.text} ${formsBaseTheme.sizes.lg.padding} ${formsBaseTheme.sizes.lg.height}`,
|
|
46
|
+
},
|
|
47
|
+
// Mode toggle button
|
|
48
|
+
modeToggleStyle: "inline-flex items-center justify-center rounded-[var(--form-radius)] px-3 py-1.5 text-sm font-medium " +
|
|
49
|
+
"cursor-pointer transition-all outline outline-1 outline-[var(--color-border)] " +
|
|
50
|
+
"text-[var(--color-text-secondary)] bg-white hover:bg-[var(--color-background-secondary)] " +
|
|
51
|
+
"dark:bg-[var(--color-neutral-900)] dark:outline-[var(--color-neutral-700)] dark:text-[var(--color-neutral-400)] " +
|
|
52
|
+
"dark:hover:bg-[var(--color-neutral-800)]",
|
|
53
|
+
// Active mode toggle
|
|
54
|
+
modeToggleActiveStyle: "outline-[var(--color-primary)] bg-[var(--color-primary-50)] text-[var(--color-primary)] " +
|
|
55
|
+
"hover:bg-[var(--color-primary-50)] " +
|
|
56
|
+
"dark:outline-[var(--color-primary-500)] dark:bg-[var(--color-primary-500)]/10 dark:text-[var(--color-primary-400)] " +
|
|
57
|
+
"dark:hover:bg-[var(--color-primary-500)]/15",
|
|
58
|
+
// Preset button
|
|
59
|
+
presetButtonStyle: "inline-flex items-center rounded-[var(--form-radius)] px-2.5 py-1 text-sm font-medium " +
|
|
60
|
+
"cursor-pointer transition-all outline outline-1 outline-[var(--color-border)] " +
|
|
61
|
+
"text-[var(--color-text-secondary)] bg-white hover:bg-[var(--color-background-secondary)] " +
|
|
62
|
+
"hover:text-[var(--color-text-primary)] " +
|
|
63
|
+
"dark:bg-[var(--color-neutral-900)] dark:outline-[var(--color-neutral-700)] dark:text-[var(--color-neutral-400)] " +
|
|
64
|
+
"dark:hover:bg-[var(--color-neutral-800)] dark:hover:text-[var(--color-neutral-200)]",
|
|
65
|
+
// Active preset button
|
|
66
|
+
presetButtonActiveStyle: "outline-[var(--color-primary)] bg-[var(--color-primary-50)] text-[var(--color-primary)] " +
|
|
67
|
+
"hover:bg-[var(--color-primary-100)] " +
|
|
68
|
+
"dark:outline-[var(--color-primary-500)] dark:bg-[var(--color-primary-500)]/10 dark:text-[var(--color-primary-400)]",
|
|
69
|
+
// Human-readable description
|
|
70
|
+
descriptionStyle: "flex items-center gap-2 text-base text-[var(--color-text-muted)] " +
|
|
71
|
+
"dark:text-[var(--color-neutral-400)]",
|
|
72
|
+
// Next runs container
|
|
73
|
+
nextRunsStyle: "flex flex-col gap-1",
|
|
74
|
+
// Individual next run item
|
|
75
|
+
nextRunItemStyle: "flex items-center gap-2 text-sm text-[var(--color-text-muted)] " +
|
|
76
|
+
"dark:text-[var(--color-neutral-400)]",
|
|
77
|
+
// Section heading
|
|
78
|
+
sectionHeadingStyle: "text-sm font-medium text-[var(--color-text-secondary)] uppercase tracking-wide " +
|
|
79
|
+
"dark:text-[var(--color-neutral-400)]",
|
|
80
|
+
// Validation error
|
|
81
|
+
errorStyle: "text-sm text-[var(--color-danger)] dark:text-[var(--color-danger-400)]",
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { cronInputTheme };
|