@flikk/ui 1.0.0-beta.30 → 1.0.0-beta.32
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/CHANGELOG.md +375 -5
- package/dist/components/ai/AgentRequest/AgentRequest.animations.d.ts +25 -0
- package/dist/components/ai/AgentRequest/AgentRequest.animations.js +81 -0
- package/dist/components/ai/AgentRequest/AgentRequest.d.ts +3 -0
- package/dist/components/ai/AgentRequest/AgentRequest.js +435 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.d.ts +2 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.js +106 -0
- package/dist/components/ai/AgentRequest/AgentRequest.types.d.ts +241 -0
- package/dist/components/ai/AgentRequest/index.d.ts +3 -0
- package/dist/components/ai/AgentStatus/AgentStatus.d.ts +3 -0
- package/dist/components/ai/AgentStatus/AgentStatus.js +144 -0
- package/dist/components/ai/AgentStatus/AgentStatus.theme.d.ts +2 -0
- package/dist/components/ai/AgentStatus/AgentStatus.theme.js +37 -0
- package/dist/components/ai/AgentStatus/AgentStatus.types.d.ts +116 -0
- package/dist/components/ai/AgentStatus/index.d.ts +3 -0
- package/dist/components/ai/CodeBlock/CodeBlock.js +3 -3
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +2 -2
- package/dist/components/ai/PromptInput/PromptInput.js +13 -14
- package/dist/components/ai/PromptInput/PromptInput.theme.js +3 -3
- package/dist/components/ai/PromptInput/VoiceRecorder.js +3 -3
- package/dist/components/ai/PromptSuggestion/PromptSuggestion.theme.js +2 -2
- package/dist/components/ai/Reasoning/Reasoning.d.ts +5 -0
- package/dist/components/ai/Reasoning/Reasoning.js +40 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.d.ts +6 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.js +36 -0
- package/dist/components/ai/Reasoning/Reasoning.types.d.ts +73 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.d.ts +11 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.js +84 -0
- package/dist/components/ai/Reasoning/index.d.ts +3 -0
- package/dist/components/ai/SourceCitation/SourceCitation.d.ts +4 -0
- package/dist/components/ai/SourceCitation/SourceCitation.js +29 -0
- package/dist/components/ai/SourceCitation/SourceCitation.theme.d.ts +2 -0
- package/dist/components/ai/SourceCitation/SourceCitation.theme.js +23 -0
- package/dist/components/ai/SourceCitation/SourceCitation.types.d.ts +55 -0
- package/dist/components/ai/SourceCitation/index.d.ts +3 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.d.ts +7 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.js +8 -7
- package/dist/components/ai/StreamingResponse/ErrorDisplay.js +2 -2
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingCursor.d.ts +2 -2
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +10 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.d.ts +10 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +59 -33
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +14 -10
- package/dist/components/ai/StreamingResponse/StreamingResponse.theme.js +3 -1
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +33 -2
- package/dist/components/ai/StreamingResponse/StreamingSurface.d.ts +13 -0
- package/dist/components/ai/StreamingResponse/StreamingSurface.js +38 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +5 -4
- package/dist/components/ai/StreamingResponse/index.d.ts +4 -2
- package/dist/components/ai/TokenCounter/TokenCounter.js +2 -2
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/ai/index.d.ts +6 -2
- package/dist/components/ai/index.js +10 -3
- package/dist/components/ai/shared/StatusIndicator.d.ts +8 -0
- package/dist/components/ai/shared/StatusIndicator.js +34 -0
- package/dist/components/canvas/BaseNode.js +1 -1
- package/dist/components/canvas/CanvasToolbar.js +2 -3
- package/dist/components/canvas/Edge.js +2 -2
- package/dist/components/canvas/NodeControls.js +2 -3
- package/dist/components/canvas/NodeRenderer.js +4 -4
- package/dist/components/charts/ActivityRings/ActivityRings.js +4 -4
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +1 -1
- package/dist/components/charts/AreaChart/AreaChart.js +24 -35
- package/dist/components/charts/AreaChart/AreaChart.theme.d.ts +1 -6
- package/dist/components/charts/AreaChart/AreaChart.theme.js +10 -22
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +18 -11
- package/dist/components/charts/AreaChart/AreaChart.types.js +10 -3
- package/dist/components/charts/AreaChart/index.d.ts +1 -1
- package/dist/components/charts/BarChart/BarChart.js +13 -32
- package/dist/components/charts/BarChart/BarChart.types.d.ts +20 -16
- package/dist/components/charts/BarChart/BarChart.types.js +11 -4
- package/dist/components/charts/ComboChart/BarRenderer.js +10 -7
- package/dist/components/charts/ComboChart/BarRenderer.types.d.ts +1 -1
- package/dist/components/charts/ComboChart/ComboChart.js +11 -24
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +15 -13
- package/dist/components/charts/ComboChart/ComboChart.types.js +14 -2
- package/dist/components/charts/ComboChart/ComboChartCanvas.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.js +16 -11
- package/dist/components/charts/ComboChart/LineRenderer.types.d.ts +1 -1
- package/dist/components/charts/DonutChart/DonutChart.theme.js +4 -4
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.theme.js +1 -1
- package/dist/components/charts/Heatmap/Heatmap.js +49 -42
- package/dist/components/charts/Heatmap/Heatmap.theme.d.ts +6 -2
- package/dist/components/charts/Heatmap/Heatmap.theme.js +20 -8
- package/dist/components/charts/Heatmap/Heatmap.types.d.ts +49 -82
- package/dist/components/charts/Heatmap/HeatmapCell.js +30 -81
- package/dist/components/charts/Heatmap/HeatmapLegend.d.ts +7 -6
- package/dist/components/charts/Heatmap/HeatmapLegend.js +6 -6
- package/dist/components/charts/Heatmap/index.d.ts +1 -1
- package/dist/components/charts/Heatmap/utils/heatmapUtils.d.ts +7 -12
- package/dist/components/charts/Heatmap/utils/heatmapUtils.js +16 -61
- package/dist/components/charts/Heatmap/utils/heatmapUtils.test.d.ts +1 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.d.ts +16 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.js +237 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.types.d.ts +62 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.types.js +21 -0
- package/dist/components/charts/HorizontalBarChart/index.d.ts +3 -0
- package/dist/components/charts/LineChart/LineChart.js +11 -28
- package/dist/components/charts/LineChart/LineChart.types.d.ts +11 -14
- package/dist/components/charts/LineChart/LineChart.types.js +11 -3
- package/dist/components/charts/LollipopChart/LollipopChart.d.ts +3 -0
- package/dist/components/charts/LollipopChart/LollipopChart.js +361 -0
- package/dist/components/charts/LollipopChart/LollipopChart.types.d.ts +42 -0
- package/dist/components/charts/LollipopChart/LollipopChart.types.js +12 -0
- package/dist/components/charts/LollipopChart/index.d.ts +3 -0
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +151 -133
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +20 -18
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.js +10 -4
- package/dist/components/charts/hooks/useChartAccessibility.d.ts +1 -1
- package/dist/components/charts/hooks/useChartAccessibility.js +12 -6
- package/dist/components/charts/hooks/useTooltipPosition.js +18 -6
- package/dist/components/charts/index.d.ts +10 -8
- package/dist/components/charts/index.js +8 -4
- package/dist/components/charts/shared/ChartAxis/CategoryYAxis.d.ts +14 -0
- package/dist/components/charts/shared/ChartAxis/CategoryYAxis.js +35 -0
- package/dist/components/charts/shared/ChartAxis/ChartAxis.types.d.ts +69 -8
- package/dist/components/charts/shared/ChartAxis/ValueXAxis.d.ts +14 -0
- package/dist/components/charts/shared/ChartAxis/ValueXAxis.js +64 -0
- package/dist/components/charts/shared/ChartAxis/XAxis.js +1 -1
- package/dist/components/charts/shared/ChartAxis/YAxis.js +2 -2
- package/dist/components/charts/shared/ChartAxis/index.d.ts +3 -1
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.d.ts +0 -2
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.js +1 -1
- package/dist/components/charts/shared/ChartGrid/VerticalGrid.d.ts +29 -0
- package/dist/components/charts/shared/ChartGrid/VerticalGrid.js +26 -0
- package/dist/components/charts/shared/ChartGrid/index.d.ts +2 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.js +7 -1
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +1 -1
- package/dist/components/charts/shared/index.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +21 -26
- package/dist/components/charts/types/chart.types.d.ts +9 -5
- package/dist/components/charts/types/chart.types.js +1 -7
- package/dist/components/charts/utils/animation-utils.d.ts +12 -7
- package/dist/components/charts/utils/animation-utils.js +19 -21
- package/dist/components/charts/utils/bar-emphasis.d.ts +32 -3
- package/dist/components/charts/utils/bar-emphasis.js +24 -8
- package/dist/components/charts/utils/index.d.ts +1 -0
- package/dist/components/charts/utils/series-color.d.ts +7 -0
- package/dist/components/charts/utils/series-color.js +20 -0
- package/dist/components/core/Accordion/Accordion.theme.js +3 -3
- package/dist/components/core/Accordion/AccordionTrigger.js +2 -2
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -3
- package/dist/components/core/Alert/Alert.animations.js +30 -8
- package/dist/components/core/Alert/Alert.js +23 -9
- package/dist/components/core/Alert/Alert.theme.js +1 -1
- package/dist/components/core/Alert/Alert.types.d.ts +4 -2
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/Avatar/Avatar.js +50 -42
- package/dist/components/core/Avatar/Avatar.theme.d.ts +8 -4
- package/dist/components/core/Avatar/Avatar.theme.js +64 -8
- package/dist/components/core/Avatar/Avatar.types.d.ts +13 -2
- package/dist/components/core/Avatar/index.d.ts +1 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.js +6 -8
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.d.ts +1 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +2 -6
- package/dist/components/core/AvatarGroup/AvatarGroup.types.d.ts +0 -6
- package/dist/components/core/AvatarGroup/index.d.ts +1 -1
- package/dist/components/core/Badge/Badge.animations.d.ts +0 -5
- package/dist/components/core/Badge/Badge.animations.js +5 -82
- package/dist/components/core/Badge/Badge.d.ts +7 -4
- package/dist/components/core/Badge/Badge.js +33 -65
- package/dist/components/core/Badge/Badge.theme.js +26 -24
- package/dist/components/core/Badge/Badge.types.d.ts +18 -34
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.d.ts +1 -4
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +6 -6
- package/dist/components/core/Button/Button.js +14 -58
- package/dist/components/core/Button/Button.theme.d.ts +2 -0
- package/dist/components/core/Button/Button.theme.js +35 -22
- package/dist/components/core/Button/Button.types.d.ts +26 -13
- package/dist/components/core/Button/index.d.ts +0 -2
- package/dist/components/core/Calendar/Calendar.js +20 -5
- package/dist/components/core/Calendar/Calendar.theme.js +15 -23
- package/dist/components/core/Calendar/Calendar.types.d.ts +0 -1
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.js +3 -3
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.theme.js +2 -2
- package/dist/components/core/Card/Card.js +7 -2
- package/dist/components/core/Card/Card.theme.js +40 -4
- package/dist/components/core/Card/Card.types.d.ts +20 -0
- package/dist/components/core/Card/CardBody.js +9 -1
- package/dist/components/core/Card/CardContext.d.ts +13 -0
- package/dist/components/core/Card/CardContext.js +14 -0
- package/dist/components/core/Card/CardFooter.js +1 -1
- package/dist/components/core/Card/CardHeader.js +4 -1
- package/dist/components/core/CommandPalette/CommandPalette.js +5 -4
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +3 -7
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +2 -0
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +4 -3
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +8 -1
- package/dist/components/core/ContextMenu/ContextMenuItem.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenuSub.d.ts +11 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.js +35 -22
- package/dist/components/core/ContextMenu/ContextMenuSubBody.js +14 -3
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +22 -9
- package/dist/components/core/DragDrop/DragDrop.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.theme.js +7 -4
- package/dist/components/core/Drawer/DrawerHeader.js +2 -3
- package/dist/components/core/Dropdown/Dropdown.theme.js +3 -1
- package/dist/components/core/Dropdown/DropdownItem.js +2 -2
- package/dist/components/core/Dropdown/DropdownMenu.js +22 -7
- package/dist/components/core/Dropdown/DropdownTrigger.js +16 -5
- package/dist/components/core/HeroCard/HeroCard.theme.js +5 -2
- package/dist/components/core/Kbd/Kbd.theme.js +4 -2
- package/dist/components/core/Link/Link.js +7 -5
- package/dist/components/core/Masonry/Masonry.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.js +2 -1
- package/dist/components/core/MenuItem/MenuItem.theme.js +13 -1
- package/dist/components/core/Message/Message.js +4 -2
- package/dist/components/core/Message/Message.theme.js +8 -10
- package/dist/components/core/Message/MessageAudio.js +2 -2
- package/dist/components/core/Message/MessageFile.js +2 -2
- package/dist/components/core/Message/MessageLink.js +2 -2
- package/dist/components/core/Message/MessageStatusIndicator.js +5 -5
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -1
- package/dist/components/core/Modal/Modal.animations.js +50 -11
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +6 -2
- package/dist/components/core/Modal/Modal.theme.js +9 -4
- package/dist/components/core/Modal/ModalHeader.js +2 -3
- package/dist/components/core/ModalStack/ModalStackModal.js +4 -2
- package/dist/components/core/NavItem/NavItem.js +8 -7
- package/dist/components/core/NavItem/NavItem.theme.js +1 -1
- package/dist/components/core/OfflineIndicator/OfflineIndicator.animations.d.ts +22 -0
- package/dist/components/core/OfflineIndicator/OfflineIndicator.animations.js +54 -0
- package/dist/components/core/OfflineIndicator/OfflineIndicator.js +23 -24
- package/dist/components/core/OfflineIndicator/OfflineIndicator.theme.js +27 -6
- package/dist/components/core/OfflineIndicator/OfflineIndicator.types.d.ts +17 -0
- package/dist/components/core/PageHeading/PageHeading.theme.js +1 -1
- package/dist/components/core/PageHeading/PageHeadingBackButton.js +2 -2
- package/dist/components/core/Pagination/Pagination.js +3 -3
- package/dist/components/core/Pagination/Pagination.theme.js +5 -5
- package/dist/components/core/Pill/Pill.js +5 -2
- package/dist/components/core/Pill/Pill.theme.js +9 -5
- package/dist/components/core/Popover/PopoverBody.js +16 -5
- package/dist/components/core/Progress/Progress.d.ts +0 -25
- package/dist/components/core/Progress/Progress.js +79 -11
- package/dist/components/core/Progress/Progress.theme.js +17 -0
- package/dist/components/core/Progress/Progress.types.d.ts +47 -1
- package/dist/components/core/Rating/Rating.js +4 -5
- package/dist/components/core/Rating/Rating.theme.js +2 -2
- package/dist/components/core/Rating/Rating.types.d.ts +3 -2
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +10 -7
- package/dist/components/core/Segmented/SegmentedContext.js +1 -0
- package/dist/components/core/Sidebar/Sidebar.js +5 -2
- package/dist/components/core/Sidebar/Sidebar.theme.js +2 -2
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +4 -2
- package/dist/components/core/Sidebar/SidebarContent.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +3 -3
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +2 -2
- package/dist/components/core/Sidebar/SidebarSearch.js +4 -4
- package/dist/components/core/Sidebar/SidebarToggle.js +3 -3
- package/dist/components/core/Sidebar/SidebarUserProfile.js +3 -3
- package/dist/components/core/Sortable/Sortable.js +2 -2
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Tag/Tag.theme.js +5 -3
- package/dist/components/core/Toast/Toast.js +3 -3
- package/dist/components/core/Toast/Toast.types.d.ts +1 -1
- package/dist/components/core/Toast/ToastProvider.js +1 -1
- package/dist/components/core/Toast/useToast.js +5 -5
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +42 -10
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +25 -0
- package/dist/components/core/Tree/Tree.js +2 -2
- package/dist/components/core/Tree/Tree.theme.js +1 -1
- package/dist/components/core/index.d.ts +0 -2
- package/dist/components/core/index.js +0 -4
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.d.ts +4 -0
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.js +20 -0
- package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.js +1 -1
- package/dist/components/core/shared/Ripple.d.ts +16 -0
- package/dist/components/core/shared/Ripple.js +141 -0
- package/dist/components/core/shared/interaction.animations.d.ts +51 -0
- package/dist/components/core/shared/interaction.animations.js +59 -0
- package/dist/components/data-display/Feed/Feed.js +2 -2
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +7 -7
- package/dist/components/data-display/GanttChart/GanttChartPanel.js +2 -2
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.js +3 -3
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +1 -1
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +2 -2
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +1 -1
- package/dist/components/data-display/GanttChart/GanttToolbar.js +2 -3
- package/dist/components/data-display/KPI/KPI.js +12 -21
- package/dist/components/data-display/KPI/KPI.theme.js +8 -4
- package/dist/components/data-display/Metric/Metric.js +2 -2
- package/dist/components/data-display/Metric/Metric.theme.js +25 -8
- package/dist/components/data-display/Metric/Metric.types.d.ts +1 -1
- package/dist/components/data-display/Table/Table.theme.js +11 -11
- package/dist/components/data-display/Table/TableActions.js +2 -2
- package/dist/components/data-display/Table/TableActionsMenu.js +1 -1
- package/dist/components/data-display/Table/TableColumnManager.js +2 -3
- package/dist/components/data-display/Table/TableContext.js +1 -0
- package/dist/components/data-display/Table/TableDeclarative.js +3 -3
- package/dist/components/data-display/Table/TableFilter.js +13 -6
- package/dist/components/data-display/Table/TableHeader.js +3 -3
- package/dist/components/data-display/Table/TableRow.js +2 -2
- package/dist/components/data-display/Table/TableSelectionHeader.js +4 -4
- package/dist/components/data-display/Timeline/Timeline.theme.js +1 -1
- package/dist/components/data-display/Timeline/TimelineMarker.js +2 -2
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.js +3 -3
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +4 -4
- package/dist/components/effects/DotPattern/DotPattern.js +6 -0
- package/dist/components/effects/DotPattern/DotPattern.types.d.ts +4 -2
- package/dist/components/effects/MeshGradient/MeshGradient.utils.d.ts +1 -1
- package/dist/components/effects/MeshGradient/MeshGradient.utils.js +1 -1
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +1 -1
- package/dist/components/effects/Overlay/Overlay.js +7 -3
- package/dist/components/effects/index.d.ts +0 -32
- package/dist/components/effects/index.js +0 -16
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.d.ts +0 -2
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.js +1 -93
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.types.d.ts +0 -10
- package/dist/components/effects/shared/ShaderCanvas/index.d.ts +1 -1
- package/dist/components/effects/shared/index.d.ts +1 -3
- package/dist/components/effects/shared/shaderNoise.glsl.d.ts +1 -1
- package/dist/components/effects/shared/shaderNoise.glsl.js +2 -11
- package/dist/components/forms/Checkbox/Checkbox.js +2 -1
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerEyeDropper.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerGradient.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerHeader.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerImage.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerInput.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerPresets.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerSavedColors.js +2 -2
- package/dist/components/forms/Combobox/Combobox.js +5 -3
- package/dist/components/forms/Combobox/Combobox.theme.js +2 -2
- package/dist/components/forms/DatePicker/DatePicker.animations.js +16 -25
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -1
- package/dist/components/forms/DatePicker/DatePickerTrigger.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +4 -4
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePickerContext.js +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +2 -2
- package/dist/components/forms/FileUpload/FileUpload.js +4 -4
- package/dist/components/forms/FileUpload/FileUpload.theme.js +7 -3
- package/dist/components/forms/FileUpload/FileUploadProgress.js +7 -7
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +1 -1
- package/dist/components/forms/Input/Input.js +6 -7
- package/dist/components/forms/Input/Input.theme.js +19 -15
- package/dist/components/forms/InputAddress/InputAddress.js +10 -3
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +2 -2
- package/dist/components/forms/InputCounter/InputCounter.js +3 -3
- package/dist/components/forms/InputOTP/InputOTP.d.ts +3 -12
- package/dist/components/forms/InputOTP/InputOTP.js +140 -151
- package/dist/components/forms/InputOTP/InputOTP.theme.d.ts +5 -1
- package/dist/components/forms/InputOTP/InputOTP.theme.js +40 -5
- package/dist/components/forms/InputOTP/InputOTP.types.d.ts +45 -2
- package/dist/components/forms/InputOTP/index.d.ts +1 -1
- package/dist/components/forms/InputTag/InputTag.js +5 -5
- package/dist/components/forms/InputTag/InputTag.theme.js +1 -2
- package/dist/components/forms/Mention/Mention.theme.js +3 -5
- package/dist/components/forms/Radio/Radio.js +3 -2
- package/dist/components/forms/Radio/Radio.theme.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +12 -16
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +165 -1681
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.d.ts +12 -56
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +60 -118
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +62 -126
- package/dist/components/forms/RichTextEditor/RichTextLinkField.d.ts +18 -0
- package/dist/components/forms/RichTextEditor/RichTextLinkField.js +46 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.d.ts +15 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.js +93 -0
- package/dist/components/forms/RichTextEditor/editorCommands.d.ts +50 -0
- package/dist/components/forms/RichTextEditor/editorCommands.js +58 -0
- package/dist/components/forms/RichTextEditor/editorState.d.ts +19 -0
- package/dist/components/forms/RichTextEditor/editorState.js +103 -0
- package/dist/components/forms/RichTextEditor/index.d.ts +5 -3
- package/dist/components/forms/RichTextEditor/sanitizeHtml.d.ts +38 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.js +179 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.test.d.ts +1 -0
- package/dist/components/forms/Select/Select.d.ts +5 -1
- package/dist/components/forms/Select/Select.js +14 -13
- package/dist/components/forms/Select/Select.theme.js +4 -4
- package/dist/components/forms/Select/Select.types.d.ts +74 -8
- package/dist/components/forms/Select/useSelectState.d.ts +9 -3
- package/dist/components/forms/Select/useSelectState.js +4 -1
- package/dist/components/forms/SelectableCard/SelectableCard.animations.d.ts +1 -2
- package/dist/components/forms/SelectableCard/SelectableCard.animations.js +6 -7
- package/dist/components/forms/SelectableCard/SelectableCard.js +3 -2
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +1 -1
- package/dist/components/forms/Signature/Signature.js +1 -1
- package/dist/components/forms/Slider/Slider.js +24 -11
- package/dist/components/forms/Slider/Slider.theme.js +9 -3
- package/dist/components/forms/Switch/Switch.theme.js +3 -3
- package/dist/components/forms/TimePicker/TimePicker.theme.js +7 -8
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -1
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +3 -3
- package/dist/components/forms/forms.theme.js +38 -13
- package/dist/components/forms/index.js +2 -1
- package/dist/components/generative/FormShell.d.ts +22 -0
- package/dist/components/generative/FormShell.js +102 -0
- package/dist/components/generative/GenerativeView.d.ts +52 -1
- package/dist/components/generative/GenerativeView.js +203 -11
- package/dist/components/generative/actions.d.ts +5 -0
- package/dist/components/generative/ai-sdk/index.d.ts +1 -0
- package/dist/components/generative/ai-sdk/index.js +1 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.d.ts +52 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.js +73 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.test.d.ts +1 -0
- package/dist/components/generative/fieldBinding.d.ts +31 -0
- package/dist/components/generative/fieldBinding.js +33 -0
- package/dist/components/generative/fieldBinding.test.d.ts +1 -0
- package/dist/components/generative/formScope.d.ts +71 -0
- package/dist/components/generative/formScope.js +135 -0
- package/dist/components/generative/index.d.ts +4 -0
- package/dist/components/generative/index.js +4 -0
- package/dist/components/generative/registry.d.ts +2 -0
- package/dist/components/generative/registry.js +197 -4
- package/dist/components/generative/resolvers.js +16 -16
- package/dist/components/generative/schema.generated.js +2522 -328
- package/dist/components/generative/toToolResult.d.ts +21 -0
- package/dist/components/generative/toToolResult.js +15 -0
- package/dist/components/generative/toToolResult.test.d.ts +1 -0
- package/dist/components/generative/validate.d.ts +10 -1
- package/dist/components/generative/validate.js +126 -11
- package/dist/components/layout/Grid/Grid.js +1 -0
- package/dist/components/layout/Section/Section.theme.js +1 -1
- package/dist/components/layout/Stack/Stack.js +1 -0
- package/dist/generative.schema.json +2522 -328
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useElapsedTime.d.ts +28 -0
- package/dist/hooks/useElapsedTime.js +37 -0
- package/dist/hooks/useSelectPortal.d.ts +10 -2
- package/dist/hooks/useSelectPortal.js +6 -3
- package/dist/index.js +2 -5
- package/dist/registry.json +3262 -2464
- package/dist/shadcn-compat.css +6 -6
- package/dist/styles/theme.test.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/render.d.ts +17 -0
- package/dist/theme.css +5 -1
- package/dist/themes/ember.css +131 -0
- package/dist/themes/iris.css +94 -0
- package/dist/themes/jade.css +139 -0
- package/dist/themes/precision.css +232 -0
- package/dist/tools.json +2557 -328
- package/dist/utils/colorUtils.d.ts +6 -6
- package/dist/utils/colorUtils.js +8 -8
- package/dist/utils/index.d.ts +0 -1
- package/package.json +39 -6
- package/src/global.scss +32 -28
- package/src/styles/theme.css +547 -176
- package/src/styles/theme.test.ts +119 -0
- package/tailwind.preset.cjs +66 -38
- package/dist/components/charts/FunnelChart/FunnelChart.animations.d.ts +0 -35
- package/dist/components/charts/FunnelChart/FunnelChart.animations.js +0 -59
- package/dist/components/charts/FunnelChart/FunnelChart.d.ts +0 -8
- package/dist/components/charts/FunnelChart/FunnelChart.js +0 -410
- package/dist/components/charts/FunnelChart/FunnelChart.theme.d.ts +0 -2
- package/dist/components/charts/FunnelChart/FunnelChart.theme.js +0 -12
- package/dist/components/charts/FunnelChart/FunnelChart.types.d.ts +0 -105
- package/dist/components/charts/FunnelChart/index.d.ts +0 -4
- package/dist/components/charts/ScatterPlot/ScatterPlot.d.ts +0 -9
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +0 -207
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.d.ts +0 -18
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +0 -42
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +0 -65
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.js +0 -12
- package/dist/components/charts/ScatterPlot/index.d.ts +0 -3
- package/dist/components/core/Button/Button.ripple.d.ts +0 -71
- package/dist/components/core/Button/Button.ripple.js +0 -236
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.d.ts +0 -4
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.theme.d.ts +0 -12
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +0 -23
- package/dist/components/core/Calendar/CalendarEvent/index.d.ts +0 -2
- package/dist/components/core/CardStack/CardStack.animations.d.ts +0 -47
- package/dist/components/core/CardStack/CardStack.d.ts +0 -3
- package/dist/components/core/CardStack/CardStack.js +0 -187
- package/dist/components/core/CardStack/CardStack.theme.d.ts +0 -6
- package/dist/components/core/CardStack/CardStack.theme.js +0 -33
- package/dist/components/core/CardStack/CardStack.types.d.ts +0 -139
- package/dist/components/core/CardStack/index.d.ts +0 -7
- package/dist/components/core/Carousel/Carousel.d.ts +0 -3
- package/dist/components/core/Carousel/Carousel.js +0 -83
- package/dist/components/core/Carousel/Carousel.theme.d.ts +0 -10
- package/dist/components/core/Carousel/Carousel.theme.js +0 -20
- package/dist/components/core/Carousel/Carousel.types.d.ts +0 -113
- package/dist/components/core/Carousel/CarouselBody.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselBody.js +0 -59
- package/dist/components/core/Carousel/CarouselContext.d.ts +0 -3
- package/dist/components/core/Carousel/CarouselContext.js +0 -13
- package/dist/components/core/Carousel/CarouselItem.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselItem.js +0 -11
- package/dist/components/core/Carousel/CarouselNext.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselNext.js +0 -16
- package/dist/components/core/Carousel/CarouselPrevious.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselPrevious.js +0 -16
- package/dist/components/core/Carousel/index.d.ts +0 -3
- package/dist/components/core/Pill/Pill.animations.d.ts +0 -32
- package/dist/components/core/Pill/Pill.animations.js +0 -16
- package/dist/components/effects/ColorPanels/ColorPanels.d.ts +0 -8
- package/dist/components/effects/ColorPanels/ColorPanels.js +0 -66
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.d.ts +0 -12
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.js +0 -218
- package/dist/components/effects/ColorPanels/ColorPanels.types.d.ts +0 -29
- package/dist/components/effects/ColorPanels/ColorPanels.types.js +0 -3
- package/dist/components/effects/ColorPanels/index.d.ts +0 -2
- package/dist/components/effects/FlutedGlass/FlutedGlass.d.ts +0 -9
- package/dist/components/effects/FlutedGlass/FlutedGlass.js +0 -80
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.d.ts +0 -12
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.js +0 -335
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.d.ts +0 -61
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.js +0 -16
- package/dist/components/effects/FlutedGlass/index.d.ts +0 -3
- package/dist/components/effects/GlassEffect/GlassEffect.d.ts +0 -15
- package/dist/components/effects/GlassEffect/GlassEffect.js +0 -38
- package/dist/components/effects/GlassEffect/GlassEffect.types.d.ts +0 -19
- package/dist/components/effects/GlassEffect/index.d.ts +0 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +0 -8
- package/dist/components/effects/GlassSurface/GlassSurface.js +0 -250
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +0 -66
- package/dist/components/effects/GlassSurface/index.d.ts +0 -2
- package/dist/components/effects/GodRays/GodRays.d.ts +0 -8
- package/dist/components/effects/GodRays/GodRays.js +0 -68
- package/dist/components/effects/GodRays/GodRays.shaders.d.ts +0 -10
- package/dist/components/effects/GodRays/GodRays.shaders.js +0 -128
- package/dist/components/effects/GodRays/GodRays.types.d.ts +0 -25
- package/dist/components/effects/GodRays/GodRays.types.js +0 -3
- package/dist/components/effects/GodRays/index.d.ts +0 -2
- package/dist/components/effects/GridPattern/GridPattern.d.ts +0 -18
- package/dist/components/effects/GridPattern/GridPattern.js +0 -65
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +0 -47
- package/dist/components/effects/GridPattern/index.d.ts +0 -2
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.d.ts +0 -10
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.js +0 -78
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.d.ts +0 -22
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.js +0 -239
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.types.d.ts +0 -52
- package/dist/components/effects/HalftoneCmyk/index.d.ts +0 -2
- package/dist/components/effects/HalftoneDots/HalftoneDots.d.ts +0 -9
- package/dist/components/effects/HalftoneDots/HalftoneDots.js +0 -68
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.d.ts +0 -13
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.js +0 -296
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.d.ts +0 -43
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.js +0 -12
- package/dist/components/effects/HalftoneDots/index.d.ts +0 -3
- package/dist/components/effects/ImageDithering/ImageDithering.d.ts +0 -9
- package/dist/components/effects/ImageDithering/ImageDithering.js +0 -68
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.d.ts +0 -12
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.js +0 -117
- package/dist/components/effects/ImageDithering/ImageDithering.types.d.ts +0 -30
- package/dist/components/effects/ImageDithering/ImageDithering.types.js +0 -8
- package/dist/components/effects/ImageDithering/index.d.ts +0 -3
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +0 -30
- package/dist/components/effects/MagneticElement/MagneticElement.js +0 -111
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +0 -44
- package/dist/components/effects/MagneticElement/index.d.ts +0 -2
- package/dist/components/effects/Metaballs/Metaballs.d.ts +0 -8
- package/dist/components/effects/Metaballs/Metaballs.js +0 -59
- package/dist/components/effects/Metaballs/Metaballs.shaders.d.ts +0 -10
- package/dist/components/effects/Metaballs/Metaballs.shaders.js +0 -102
- package/dist/components/effects/Metaballs/Metaballs.types.d.ts +0 -16
- package/dist/components/effects/Metaballs/Metaballs.types.js +0 -3
- package/dist/components/effects/Metaballs/index.d.ts +0 -2
- package/dist/components/effects/PaperTexture/PaperTexture.d.ts +0 -9
- package/dist/components/effects/PaperTexture/PaperTexture.js +0 -61
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.d.ts +0 -22
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.js +0 -145
- package/dist/components/effects/PaperTexture/PaperTexture.types.d.ts +0 -19
- package/dist/components/effects/PaperTexture/index.d.ts +0 -2
- package/dist/components/effects/PulsingBorder/PulsingBorder.d.ts +0 -27
- package/dist/components/effects/PulsingBorder/PulsingBorder.js +0 -174
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.d.ts +0 -14
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.js +0 -258
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.d.ts +0 -75
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.js +0 -3
- package/dist/components/effects/PulsingBorder/index.d.ts +0 -2
- package/dist/components/effects/SmokeRing/SmokeRing.d.ts +0 -8
- package/dist/components/effects/SmokeRing/SmokeRing.js +0 -62
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.d.ts +0 -14
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.js +0 -130
- package/dist/components/effects/SmokeRing/SmokeRing.types.d.ts +0 -22
- package/dist/components/effects/SmokeRing/SmokeRing.types.js +0 -3
- package/dist/components/effects/SmokeRing/index.d.ts +0 -2
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.d.ts +0 -9
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.js +0 -59
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.d.ts +0 -14
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.js +0 -129
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.d.ts +0 -23
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.js +0 -3
- package/dist/components/effects/StaticGradientMesh/index.d.ts +0 -2
- package/dist/components/effects/Water/Water.d.ts +0 -9
- package/dist/components/effects/Water/Water.js +0 -65
- package/dist/components/effects/Water/Water.shaders.d.ts +0 -11
- package/dist/components/effects/Water/Water.shaders.js +0 -123
- package/dist/components/effects/Water/Water.types.d.ts +0 -25
- package/dist/components/effects/Water/index.d.ts +0 -2
- package/dist/components/effects/shared/bayerMatrices.glsl.d.ts +0 -10
- package/dist/components/effects/shared/bayerMatrices.glsl.js +0 -44
- package/dist/components/effects/shared/imageUV.glsl.d.ts +0 -12
- package/dist/components/effects/shared/imageUV.glsl.js +0 -26
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.d.ts +0 -7
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.js +0 -32
- package/dist/utils/calendarUtils.d.ts +0 -60
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.js +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.types.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltipContent.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/index.d.ts +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface CalendarEventThemeOverrides {
|
|
2
|
-
monthly?: string;
|
|
3
|
-
weekly?: string;
|
|
4
|
-
daily?: {
|
|
5
|
-
container?: string;
|
|
6
|
-
accent?: string;
|
|
7
|
-
time?: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare const calendarEventTheme: CalendarEventThemeOverrides;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
import { CalendarEventThemeOverrides } from "./CalendarEvent.theme";
|
|
3
|
-
import { CalendarEvent as CalendarEventType, GridConfig, EventPosition } from "../../../../utils";
|
|
4
|
-
export type CalendarEventVariant = "daily" | "weekly" | "monthly";
|
|
5
|
-
export interface CalendarEventProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
variant?: CalendarEventVariant;
|
|
7
|
-
event: CalendarEventType & {
|
|
8
|
-
description?: string;
|
|
9
|
-
attendees?: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
src: string;
|
|
12
|
-
showTooltip?: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
};
|
|
15
|
-
gridConfig?: GridConfig;
|
|
16
|
-
position?: EventPosition;
|
|
17
|
-
containerWidth?: number;
|
|
18
|
-
cellHeight?: number;
|
|
19
|
-
gridInterval?: number;
|
|
20
|
-
startOffset?: number;
|
|
21
|
-
theme?: CalendarEventThemeOverrides;
|
|
22
|
-
onEventClick?: (eventData: CalendarEventProps["event"]) => void;
|
|
23
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Variants } from "motion/react";
|
|
2
|
-
import { CardStackSwipeDirection } from "./CardStack.types";
|
|
3
|
-
/**
|
|
4
|
-
* Animation variants for card stack positioning
|
|
5
|
-
* Cards animate from stacked position to active position and back
|
|
6
|
-
*/
|
|
7
|
-
export declare const cardStackAnimations: Variants;
|
|
8
|
-
/**
|
|
9
|
-
* Drag constraints to keep card in place while allowing drag gesture
|
|
10
|
-
*/
|
|
11
|
-
export declare const dragConstraints: {
|
|
12
|
-
left: number;
|
|
13
|
-
right: number;
|
|
14
|
-
top: number;
|
|
15
|
-
bottom: number;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Spring configuration for natural card movement
|
|
19
|
-
* Provides smooth, physics-based animations
|
|
20
|
-
*/
|
|
21
|
-
export declare const cardSpringConfig: {
|
|
22
|
-
type: "spring";
|
|
23
|
-
damping: number;
|
|
24
|
-
stiffness: number;
|
|
25
|
-
mass: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Calculate 3D rotation based on drag position
|
|
29
|
-
* Creates natural tilt effect during drag
|
|
30
|
-
*
|
|
31
|
-
* @param x - Horizontal drag offset
|
|
32
|
-
* @param y - Vertical drag offset
|
|
33
|
-
* @param rotationRange - Maximum rotation in degrees
|
|
34
|
-
* @returns Object with rotateX, rotateY, rotateZ values
|
|
35
|
-
*/
|
|
36
|
-
export declare const calculateRotation: (x: number, y: number, rotationRange: number) => {
|
|
37
|
-
rotateX: number;
|
|
38
|
-
rotateY: number;
|
|
39
|
-
rotateZ: number;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Generate exit animation based on swipe direction
|
|
43
|
-
*
|
|
44
|
-
* @param direction - Direction of swipe ('left' or 'right')
|
|
45
|
-
* @returns Variants object for exit animation
|
|
46
|
-
*/
|
|
47
|
-
export declare const cardSwipeAnimation: (direction: CardStackSwipeDirection) => Variants;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React__default, { useMemo, Children, isValidElement, useState, useEffect, useRef, useCallback } from 'react';
|
|
4
|
-
import { useReducedMotion, motion, useMotionValue, useTransform } from 'motion/react';
|
|
5
|
-
import { cn } from '../../../utils/cn.js';
|
|
6
|
-
import { cardStackTheme } from './CardStack.theme.js';
|
|
7
|
-
|
|
8
|
-
function CardRotate({ children, onSendToBack, dragThreshold, disabled, shouldReduceMotion, }) {
|
|
9
|
-
const x = useMotionValue(0);
|
|
10
|
-
const y = useMotionValue(0);
|
|
11
|
-
const rotateX = useTransform(y, [-100, 100], [60, -60]);
|
|
12
|
-
const rotateY = useTransform(x, [-100, 100], [-60, 60]);
|
|
13
|
-
function handleDragEnd(_event, info) {
|
|
14
|
-
const sensitivity = dragThreshold * 300; // Convert to pixels
|
|
15
|
-
if (Math.abs(info.offset.x) > sensitivity ||
|
|
16
|
-
Math.abs(info.offset.y) > sensitivity) {
|
|
17
|
-
onSendToBack();
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
x.set(0);
|
|
21
|
-
y.set(0);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (disabled || shouldReduceMotion) {
|
|
25
|
-
return (jsx(motion.div, { className: "absolute inset-0 cursor-pointer", style: { x: 0, y: 0 }, children: children }));
|
|
26
|
-
}
|
|
27
|
-
return (jsx(motion.div, { className: "absolute inset-0 cursor-grab", style: { x, y, rotateX, rotateY }, drag: true, dragConstraints: { top: 0, right: 0, bottom: 0, left: 0 }, dragElastic: 0.6, whileTap: { cursor: "grabbing" }, onDragEnd: handleDragEnd, children: children }));
|
|
28
|
-
}
|
|
29
|
-
const CARD_SPRING_TRANSITION = {
|
|
30
|
-
type: "spring",
|
|
31
|
-
stiffness: 260,
|
|
32
|
-
damping: 20,
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* CardStack - Interactive card stack component with drag/swipe gestures
|
|
36
|
-
*/
|
|
37
|
-
const CardStackRoot = React__default.forwardRef(({
|
|
38
|
-
// Behavior props
|
|
39
|
-
draggable = true, dragThreshold = 0.3, loop = false, rotationRange = 5, autoPlay = false, autoPlayInterval = 3000,
|
|
40
|
-
// Callbacks
|
|
41
|
-
onCardChange, onCardSwipe,
|
|
42
|
-
// Appearance
|
|
43
|
-
perspective = "md", scaleStep = 0.06,
|
|
44
|
-
// Accessibility
|
|
45
|
-
"aria-label": ariaLabel, disabled = false,
|
|
46
|
-
// Theme & Styling
|
|
47
|
-
theme: themeOverrides, className,
|
|
48
|
-
// Children
|
|
49
|
-
children, ...rest }, ref) => {
|
|
50
|
-
// Extract cards from children
|
|
51
|
-
const cardsArray = useMemo(() => {
|
|
52
|
-
return Children.toArray(children).filter((child) => isValidElement(child));
|
|
53
|
-
}, [children]);
|
|
54
|
-
const totalCards = cardsArray.length;
|
|
55
|
-
// Stack state: array of objects with id and content
|
|
56
|
-
// Last item in array is on TOP visually
|
|
57
|
-
const [stack, setStack] = useState(() => {
|
|
58
|
-
return cardsArray.map((content, index) => ({
|
|
59
|
-
id: index,
|
|
60
|
-
content,
|
|
61
|
-
}));
|
|
62
|
-
});
|
|
63
|
-
// Update stack when children change
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setStack(cardsArray.map((content, index) => ({
|
|
66
|
-
id: index,
|
|
67
|
-
content,
|
|
68
|
-
})));
|
|
69
|
-
}, [cardsArray]);
|
|
70
|
-
// Pause state for autoplay
|
|
71
|
-
const [isPaused, setIsPaused] = useState(false);
|
|
72
|
-
// Check for reduced motion
|
|
73
|
-
const shouldReduceMotion = useReducedMotion();
|
|
74
|
-
// Track if component is mounted
|
|
75
|
-
const isMounted = useRef(true);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
return () => {
|
|
78
|
-
isMounted.current = false;
|
|
79
|
-
};
|
|
80
|
-
}, []);
|
|
81
|
-
// Merge theme with overrides
|
|
82
|
-
const theme = useMemo(() => {
|
|
83
|
-
var _a, _b, _c, _d, _e, _f;
|
|
84
|
-
const baseTheme = cardStackTheme;
|
|
85
|
-
const overrides = themeOverrides || {};
|
|
86
|
-
return {
|
|
87
|
-
rootStyle: overrides.rootStyle || baseTheme.rootStyle,
|
|
88
|
-
containerStyle: overrides.containerStyle || baseTheme.containerStyle,
|
|
89
|
-
cardBaseStyle: overrides.cardBaseStyle || baseTheme.cardBaseStyle,
|
|
90
|
-
cardDisabledStyle: overrides.cardDisabledStyle || baseTheme.cardDisabledStyle,
|
|
91
|
-
perspective: {
|
|
92
|
-
sm: ((_a = overrides.perspective) === null || _a === void 0 ? void 0 : _a.sm) || baseTheme.perspective.sm,
|
|
93
|
-
md: ((_b = overrides.perspective) === null || _b === void 0 ? void 0 : _b.md) || baseTheme.perspective.md,
|
|
94
|
-
lg: ((_c = overrides.perspective) === null || _c === void 0 ? void 0 : _c.lg) || baseTheme.perspective.lg,
|
|
95
|
-
},
|
|
96
|
-
states: {
|
|
97
|
-
idle: ((_d = overrides.states) === null || _d === void 0 ? void 0 : _d.idle) || baseTheme.states.idle,
|
|
98
|
-
dragging: ((_e = overrides.states) === null || _e === void 0 ? void 0 : _e.dragging) || baseTheme.states.dragging,
|
|
99
|
-
exiting: ((_f = overrides.states) === null || _f === void 0 ? void 0 : _f.exiting) || baseTheme.states.exiting,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}, [themeOverrides]);
|
|
103
|
-
// Send card to back of stack (becomes bottom card)
|
|
104
|
-
const sendToBack = useCallback((id) => {
|
|
105
|
-
setStack((prev) => {
|
|
106
|
-
const newStack = [...prev];
|
|
107
|
-
const index = newStack.findIndex((card) => card.id === id);
|
|
108
|
-
const [card] = newStack.splice(index, 1);
|
|
109
|
-
newStack.unshift(card); // Add to beginning (bottom of visual stack)
|
|
110
|
-
return newStack;
|
|
111
|
-
});
|
|
112
|
-
onCardChange === null || onCardChange === void 0 ? void 0 : onCardChange(id);
|
|
113
|
-
onCardSwipe === null || onCardSwipe === void 0 ? void 0 : onCardSwipe(id, "left");
|
|
114
|
-
}, [onCardChange, onCardSwipe]);
|
|
115
|
-
// Autoplay logic
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (!autoPlay || disabled || isPaused || stack.length <= 1)
|
|
118
|
-
return;
|
|
119
|
-
const timer = setInterval(() => {
|
|
120
|
-
if (isMounted.current) {
|
|
121
|
-
const topCardId = stack[stack.length - 1].id; // Last item is on top
|
|
122
|
-
sendToBack(topCardId);
|
|
123
|
-
}
|
|
124
|
-
}, autoPlayInterval);
|
|
125
|
-
return () => clearInterval(timer);
|
|
126
|
-
}, [autoPlay, disabled, isPaused, stack, autoPlayInterval, sendToBack]);
|
|
127
|
-
// Pause/resume handlers for autoplay
|
|
128
|
-
const handleMouseEnter = useCallback(() => {
|
|
129
|
-
if (autoPlay) {
|
|
130
|
-
setIsPaused(true);
|
|
131
|
-
}
|
|
132
|
-
}, [autoPlay]);
|
|
133
|
-
const handleMouseLeave = useCallback(() => {
|
|
134
|
-
if (autoPlay) {
|
|
135
|
-
setIsPaused(false);
|
|
136
|
-
}
|
|
137
|
-
}, [autoPlay]);
|
|
138
|
-
// Keyboard navigation
|
|
139
|
-
const handleKeyDown = useCallback((e) => {
|
|
140
|
-
if (disabled || stack.length === 0)
|
|
141
|
-
return;
|
|
142
|
-
switch (e.key) {
|
|
143
|
-
case "ArrowRight":
|
|
144
|
-
case " ":
|
|
145
|
-
case "Enter":
|
|
146
|
-
e.preventDefault();
|
|
147
|
-
const topCardId = stack[stack.length - 1].id;
|
|
148
|
-
sendToBack(topCardId);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}, [disabled, stack, sendToBack]);
|
|
152
|
-
// Generate stable random rotations per card
|
|
153
|
-
const randomRotations = useRef(new Map());
|
|
154
|
-
const getRandomRotation = useCallback((cardId) => {
|
|
155
|
-
if (!randomRotations.current.has(cardId)) {
|
|
156
|
-
randomRotations.current.set(cardId, rotationRange ? Math.random() * rotationRange * 2 - rotationRange : 0);
|
|
157
|
-
}
|
|
158
|
-
return randomRotations.current.get(cardId);
|
|
159
|
-
}, [rotationRange]);
|
|
160
|
-
// Memoize theme classes
|
|
161
|
-
const themeClasses = useMemo(() => ({
|
|
162
|
-
root: cn(theme.rootStyle, theme.perspective[perspective], disabled && "opacity-50 pointer-events-none", className),
|
|
163
|
-
container: theme.containerStyle,
|
|
164
|
-
}), [theme, perspective, disabled, className]);
|
|
165
|
-
// Don't render if no cards
|
|
166
|
-
if (totalCards === 0) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return (jsx("div", { ref: ref, role: "region", "aria-roledescription": "card stack", "aria-label": ariaLabel || "Interactive card stack", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, "data-disabled": disabled, className: themeClasses.root, style: {
|
|
170
|
-
perspective: 600,
|
|
171
|
-
}, ...rest, children: jsx("div", { className: themeClasses.container, children: stack.map((card, index) => {
|
|
172
|
-
const randomRotate = getRandomRotation(card.id);
|
|
173
|
-
// Top card is last in array (stack.length - 1)
|
|
174
|
-
// index 0 = bottom card, index stack.length-1 = top card
|
|
175
|
-
const visualIndex = stack.length - index - 1;
|
|
176
|
-
const isTopCard = index === stack.length - 1;
|
|
177
|
-
return (jsx(CardRotate, { onSendToBack: () => sendToBack(card.id), dragThreshold: dragThreshold, disabled: !draggable || !isTopCard || disabled, shouldReduceMotion: !!shouldReduceMotion, children: jsx(motion.div, { className: cn(theme.cardBaseStyle, disabled && theme.cardDisabledStyle), animate: {
|
|
178
|
-
rotateZ: visualIndex * 4 + randomRotate,
|
|
179
|
-
scale: 1 + index * scaleStep - stack.length * scaleStep,
|
|
180
|
-
transformOrigin: "90% 90%",
|
|
181
|
-
}, initial: false, transition: CARD_SPRING_TRANSITION, children: card.content }) }, card.id));
|
|
182
|
-
}) }) }));
|
|
183
|
-
});
|
|
184
|
-
CardStackRoot.displayName = "CardStack";
|
|
185
|
-
const CardStack = CardStackRoot;
|
|
186
|
-
|
|
187
|
-
export { CardStack };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { cn } from '../../../utils/cn.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Default theme for CardStack component
|
|
5
|
-
* Uses CSS variables for theming and follows shadcn override pattern
|
|
6
|
-
*/
|
|
7
|
-
const cardStackTheme = {
|
|
8
|
-
// Container styles
|
|
9
|
-
rootStyle: "relative w-full flex items-center justify-center",
|
|
10
|
-
containerStyle: cn("relative w-full h-full", "touch-none select-none", // Prevent default touch behaviors
|
|
11
|
-
"[transform-style:preserve-3d]" // Enable 3D transforms
|
|
12
|
-
),
|
|
13
|
-
// Card base styles
|
|
14
|
-
cardBaseStyle: cn("absolute inset-0 w-full h-full", "rounded-[var(--card-radius,0.5rem)] bg-white", "border border-[var(--color-border)]", "shadow-lg", "cursor-grab active:cursor-grabbing", "transition-shadow duration-200", "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2", "[transform-style:preserve-3d]", // Enable 3D transforms on card
|
|
15
|
-
"[backface-visibility:hidden]" // Prevent rendering artifacts during transforms
|
|
16
|
-
),
|
|
17
|
-
// Disabled card styles
|
|
18
|
-
cardDisabledStyle: "opacity-50 cursor-not-allowed pointer-events-none",
|
|
19
|
-
// Perspective variants for 3D depth effect
|
|
20
|
-
perspective: {
|
|
21
|
-
sm: "[perspective:800px]",
|
|
22
|
-
md: "[perspective:1000px]",
|
|
23
|
-
lg: "[perspective:1200px]",
|
|
24
|
-
},
|
|
25
|
-
// State-based styles using data-[state=*] attributes
|
|
26
|
-
states: {
|
|
27
|
-
idle: "shadow-lg cursor-grab",
|
|
28
|
-
dragging: "shadow-2xl z-50 cursor-grabbing",
|
|
29
|
-
exiting: "pointer-events-none",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { cardStackTheme };
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Size of the 3D perspective effect
|
|
4
|
-
*/
|
|
5
|
-
export type CardStackPerspective = "sm" | "md" | "lg";
|
|
6
|
-
/**
|
|
7
|
-
* Direction of card swipe
|
|
8
|
-
*/
|
|
9
|
-
export type CardStackSwipeDirection = "left" | "right";
|
|
10
|
-
/**
|
|
11
|
-
* Card state for styling
|
|
12
|
-
*/
|
|
13
|
-
export type CardStackCardState = "idle" | "dragging" | "exiting";
|
|
14
|
-
/**
|
|
15
|
-
* Props for the CardStack root component
|
|
16
|
-
*/
|
|
17
|
-
export interface CardStackProps extends Omit<HTMLAttributes<HTMLDivElement>, "onError"> {
|
|
18
|
-
/** Enable drag interaction @default true */
|
|
19
|
-
draggable?: boolean;
|
|
20
|
-
/** Enable swipe on mobile @default true */
|
|
21
|
-
swipeable?: boolean;
|
|
22
|
-
/** Drag sensitivity threshold (0-1) @default 0.3 */
|
|
23
|
-
dragThreshold?: number;
|
|
24
|
-
/** Enable infinite loop of cards @default false */
|
|
25
|
-
loop?: boolean;
|
|
26
|
-
/** Random rotation range in degrees @default 3 */
|
|
27
|
-
rotationRange?: number;
|
|
28
|
-
/** Enable autoplay @default false */
|
|
29
|
-
autoPlay?: boolean;
|
|
30
|
-
/** Autoplay interval in milliseconds @default 5000 */
|
|
31
|
-
autoPlayInterval?: number;
|
|
32
|
-
/** Called when active card changes */
|
|
33
|
-
onCardChange?: (index: number) => void;
|
|
34
|
-
/** Called when card is swiped */
|
|
35
|
-
onCardSwipe?: (index: number, direction: CardStackSwipeDirection) => void;
|
|
36
|
-
/** Called when all cards are exhausted */
|
|
37
|
-
onStackEmpty?: () => void;
|
|
38
|
-
/** Current active card index (controlled) */
|
|
39
|
-
currentIndex?: number;
|
|
40
|
-
/** Initial card index (uncontrolled) @default 0 */
|
|
41
|
-
defaultIndex?: number;
|
|
42
|
-
/** Stack perspective depth @default 'md' */
|
|
43
|
-
perspective?: CardStackPerspective;
|
|
44
|
-
/** Maximum visible cards in stack @default 3 */
|
|
45
|
-
stackDepth?: number;
|
|
46
|
-
/** Scale reduction per stacked card @default 0.05 */
|
|
47
|
-
scaleStep?: number;
|
|
48
|
-
/** Vertical offset per stacked card in pixels @default 10 */
|
|
49
|
-
offsetStep?: number;
|
|
50
|
-
/** Accessible label for the card stack */
|
|
51
|
-
"aria-label"?: string;
|
|
52
|
-
/** Disable all interactions @default false */
|
|
53
|
-
disabled?: boolean;
|
|
54
|
-
/** Custom theme overrides */
|
|
55
|
-
theme?: CardStackThemeOverrides;
|
|
56
|
-
/** Custom class name */
|
|
57
|
-
className?: string;
|
|
58
|
-
/** Children (CardStack.Card components) */
|
|
59
|
-
children?: ReactNode;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Props for CardStack.Card component
|
|
63
|
-
*/
|
|
64
|
-
export interface CardStackCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
65
|
-
/** Unique identifier for the card (required) */
|
|
66
|
-
value: string;
|
|
67
|
-
/** Card content */
|
|
68
|
-
children?: ReactNode;
|
|
69
|
-
/** Custom class name for card styling */
|
|
70
|
-
className?: string;
|
|
71
|
-
/** Disable interaction for this specific card @default false */
|
|
72
|
-
disabled?: boolean;
|
|
73
|
-
/** Override rotation for this card (in degrees) */
|
|
74
|
-
rotation?: number;
|
|
75
|
-
/** Custom data attached to card for callbacks */
|
|
76
|
-
data?: Record<string, unknown>;
|
|
77
|
-
/** Called when this card is focused */
|
|
78
|
-
onFocus?: () => void;
|
|
79
|
-
/** Called when this card is removed from stack */
|
|
80
|
-
onRemove?: () => void;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Context value shared between CardStack components
|
|
84
|
-
*/
|
|
85
|
-
export interface CardStackContextValue {
|
|
86
|
-
currentIndex: number;
|
|
87
|
-
totalCards: number;
|
|
88
|
-
stackOrder: number[];
|
|
89
|
-
sendToBack: (index: number) => void;
|
|
90
|
-
goToNext: () => void;
|
|
91
|
-
goToPrevious: () => void;
|
|
92
|
-
goToCard: (index: number) => void;
|
|
93
|
-
reset: () => void;
|
|
94
|
-
draggable: boolean;
|
|
95
|
-
swipeable: boolean;
|
|
96
|
-
dragThreshold: number;
|
|
97
|
-
rotationRange: number;
|
|
98
|
-
disabled: boolean;
|
|
99
|
-
perspective: CardStackPerspective;
|
|
100
|
-
stackDepth: number;
|
|
101
|
-
scaleStep: number;
|
|
102
|
-
offsetStep: number;
|
|
103
|
-
canGoNext: boolean;
|
|
104
|
-
canGoPrevious: boolean;
|
|
105
|
-
isStackEmpty: boolean;
|
|
106
|
-
onCardSwipe?: (index: number, direction: CardStackSwipeDirection) => void;
|
|
107
|
-
theme: CardStackTheme;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Theme configuration for CardStack
|
|
111
|
-
*/
|
|
112
|
-
export interface CardStackTheme {
|
|
113
|
-
rootStyle: string;
|
|
114
|
-
containerStyle: string;
|
|
115
|
-
cardBaseStyle: string;
|
|
116
|
-
cardDisabledStyle: string;
|
|
117
|
-
perspective: Record<CardStackPerspective, string>;
|
|
118
|
-
states: Record<CardStackCardState, string>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Theme overrides for CardStack
|
|
122
|
-
*/
|
|
123
|
-
export interface CardStackThemeOverrides {
|
|
124
|
-
rootStyle?: string;
|
|
125
|
-
containerStyle?: string;
|
|
126
|
-
cardBaseStyle?: string;
|
|
127
|
-
cardDisabledStyle?: string;
|
|
128
|
-
perspective?: Partial<Record<CardStackPerspective, string>>;
|
|
129
|
-
states?: Partial<Record<CardStackCardState, string>>;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Animation custom values for card positioning
|
|
133
|
-
*/
|
|
134
|
-
export interface CardStackAnimationCustom {
|
|
135
|
-
index: number;
|
|
136
|
-
stackDepth: number;
|
|
137
|
-
scaleStep: number;
|
|
138
|
-
offsetStep: number;
|
|
139
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CardStack - Interactive card stack component with drag/swipe gestures
|
|
3
|
-
*
|
|
4
|
-
* @module CardStack
|
|
5
|
-
*/
|
|
6
|
-
export { CardStack } from "./CardStack";
|
|
7
|
-
export type { CardStackProps, CardStackTheme, CardStackThemeOverrides, CardStackPerspective, CardStackSwipeDirection, } from "./CardStack.types";
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React__default, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
-
import { cn } from '../../../utils/cn.js';
|
|
5
|
-
import { carouselTheme } from './Carousel.theme.js';
|
|
6
|
-
import { CarouselContext } from './CarouselContext.js';
|
|
7
|
-
import { CarouselBody } from './CarouselBody.js';
|
|
8
|
-
import { CarouselItem } from './CarouselItem.js';
|
|
9
|
-
import { CarouselPrevious } from './CarouselPrevious.js';
|
|
10
|
-
import { CarouselNext } from './CarouselNext.js';
|
|
11
|
-
|
|
12
|
-
const CarouselRoot = React__default.forwardRef(({ orientation = 'horizontal', opts = {}, showControls = false, defaultIndex = 0, onSlideChange, className, children, ...rest }, ref) => {
|
|
13
|
-
const { align = 'start', loop = false, slidesToScroll = 1, draggable = true, dragThreshold = 0.1, } = opts;
|
|
14
|
-
// Count total slides by looking for CarouselBody and its CarouselItem children
|
|
15
|
-
const totalSlides = React__default.useMemo(() => {
|
|
16
|
-
let count = 0;
|
|
17
|
-
React__default.Children.forEach(children, (child) => {
|
|
18
|
-
if (React__default.isValidElement(child) && child.type === CarouselBody) {
|
|
19
|
-
const contentProps = child.props;
|
|
20
|
-
count = React__default.Children.count(contentProps.children);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return count;
|
|
24
|
-
}, [children]);
|
|
25
|
-
const [currentIndex, setCurrentIndex] = useState(() => {
|
|
26
|
-
return Math.max(0, Math.min(defaultIndex, totalSlides - 1));
|
|
27
|
-
});
|
|
28
|
-
// Ensure current index stays in range when total slides change
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (currentIndex >= totalSlides && totalSlides > 0) {
|
|
31
|
-
setCurrentIndex(totalSlides - 1);
|
|
32
|
-
}
|
|
33
|
-
}, [totalSlides, currentIndex]);
|
|
34
|
-
// Call onSlideChange when index changes
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
onSlideChange === null || onSlideChange === void 0 ? void 0 : onSlideChange(currentIndex);
|
|
37
|
-
}, [currentIndex, onSlideChange]);
|
|
38
|
-
const scrollTo = useCallback((index) => {
|
|
39
|
-
if (totalSlides === 0)
|
|
40
|
-
return;
|
|
41
|
-
if (loop) {
|
|
42
|
-
// Handle loop mode with wrapping
|
|
43
|
-
const normalizedIndex = ((index % totalSlides) + totalSlides) % totalSlides;
|
|
44
|
-
setCurrentIndex(normalizedIndex);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
// Clamp to valid range in non-loop mode
|
|
48
|
-
const clampedIndex = Math.max(0, Math.min(index, totalSlides - 1));
|
|
49
|
-
setCurrentIndex(clampedIndex);
|
|
50
|
-
}
|
|
51
|
-
}, [totalSlides, loop]);
|
|
52
|
-
const scrollPrev = useCallback(() => {
|
|
53
|
-
scrollTo(currentIndex - slidesToScroll);
|
|
54
|
-
}, [currentIndex, slidesToScroll, scrollTo]);
|
|
55
|
-
const scrollNext = useCallback(() => {
|
|
56
|
-
scrollTo(currentIndex + slidesToScroll);
|
|
57
|
-
}, [currentIndex, slidesToScroll, scrollTo]);
|
|
58
|
-
const canScrollPrev = loop || currentIndex > 0;
|
|
59
|
-
const canScrollNext = loop || currentIndex < totalSlides - 1;
|
|
60
|
-
const memoizedOpts = useMemo(() => ({ align, loop, slidesToScroll, draggable, dragThreshold }), [align, loop, slidesToScroll, draggable, dragThreshold]);
|
|
61
|
-
const contextValue = useMemo(() => ({
|
|
62
|
-
currentIndex,
|
|
63
|
-
totalSlides,
|
|
64
|
-
scrollTo,
|
|
65
|
-
scrollPrev,
|
|
66
|
-
scrollNext,
|
|
67
|
-
canScrollPrev,
|
|
68
|
-
canScrollNext,
|
|
69
|
-
orientation,
|
|
70
|
-
opts: memoizedOpts,
|
|
71
|
-
}), [currentIndex, totalSlides, scrollTo, scrollPrev, scrollNext, canScrollPrev, canScrollNext, orientation, memoizedOpts]);
|
|
72
|
-
return (jsx(CarouselContext.Provider, { value: contextValue, children: jsxs("div", { ref: ref, role: "region", "aria-roledescription": "carousel", "aria-label": "Carousel", className: cn(carouselTheme.root, className), ...rest, children: [children, showControls && totalSlides > 1 && (jsxs("div", { className: carouselTheme.controls, children: [jsx(CarouselPrevious, {}), jsx(CarouselNext, {})] }))] }) }));
|
|
73
|
-
});
|
|
74
|
-
CarouselRoot.displayName = 'Carousel';
|
|
75
|
-
// Create compound component with sub-components
|
|
76
|
-
const Carousel = Object.assign(CarouselRoot, {
|
|
77
|
-
Body: CarouselBody,
|
|
78
|
-
Item: CarouselItem,
|
|
79
|
-
Previous: CarouselPrevious,
|
|
80
|
-
Next: CarouselNext,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export { Carousel };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const carouselTheme = {
|
|
2
|
-
root: 'relative w-full flex flex-col',
|
|
3
|
-
viewport: 'overflow-hidden',
|
|
4
|
-
container: 'flex',
|
|
5
|
-
item: 'min-w-0 shrink-0 grow-0 basis-full',
|
|
6
|
-
controls: 'flex items-center justify-center gap-2',
|
|
7
|
-
button: `
|
|
8
|
-
inline-flex items-center justify-center -mt-5 z-10 cursor-pointer
|
|
9
|
-
size-10 rounded-full
|
|
10
|
-
bg-white/50 backdrop-blur-md border-t border-[var(--color-border)]
|
|
11
|
-
text-[var(--color-text-primary)]
|
|
12
|
-
transition-all duration-200
|
|
13
|
-
hover:bg-white/80 hover:shadow-lg
|
|
14
|
-
focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2
|
|
15
|
-
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-white disabled:hover:border-[var(--color-border)]
|
|
16
|
-
`,
|
|
17
|
-
buttonIcon: 'size-5',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { carouselTheme };
|