@flikk/ui 1.0.0-beta.27 → 1.0.0-beta.29
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/bg/1.webp +0 -0
- package/dist/bg/10.webp +0 -0
- package/dist/bg/11.webp +0 -0
- package/dist/bg/12.webp +0 -0
- package/dist/bg/13.webp +0 -0
- package/dist/bg/14.webp +0 -0
- package/dist/bg/15.webp +0 -0
- package/dist/bg/16.webp +0 -0
- package/dist/bg/17.webp +0 -0
- package/dist/bg/18.webp +0 -0
- package/dist/bg/19.webp +0 -0
- package/dist/bg/2.webp +0 -0
- package/dist/bg/20.webp +0 -0
- package/dist/bg/21.webp +0 -0
- package/dist/bg/22.webp +0 -0
- package/dist/bg/3.webp +0 -0
- package/dist/bg/4.webp +0 -0
- package/dist/bg/5.webp +0 -0
- package/dist/bg/6.webp +0 -0
- package/dist/bg/7.webp +0 -0
- package/dist/bg/8.webp +0 -0
- package/dist/bg/9.webp +0 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +7 -143
- package/dist/components/ai/PromptInput/VoiceRecorder.js +0 -88
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/canvas/Background.d.ts +19 -0
- package/dist/components/canvas/Background.js +23 -0
- package/dist/components/canvas/BaseNode.d.ts +15 -0
- package/dist/components/canvas/BaseNode.js +20 -0
- package/dist/components/canvas/CanvasToolbar.d.ts +34 -0
- package/dist/components/canvas/CanvasToolbar.js +34 -0
- package/dist/components/canvas/Edge.d.ts +35 -0
- package/dist/components/canvas/Edge.js +97 -0
- package/dist/components/canvas/EdgeLayer.d.ts +18 -0
- package/dist/components/canvas/EdgeLayer.js +111 -0
- package/dist/components/canvas/Handle.d.ts +11 -0
- package/dist/components/canvas/Handle.js +63 -0
- package/dist/components/canvas/MiniMap.d.ts +22 -0
- package/dist/components/canvas/MiniMap.js +105 -0
- package/dist/components/canvas/NodeCanvas.d.ts +10 -0
- package/dist/components/canvas/NodeCanvas.js +477 -0
- package/dist/components/canvas/NodeCanvas.theme.d.ts +7 -0
- package/dist/components/canvas/NodeCanvas.theme.js +9 -0
- package/dist/components/canvas/NodeCanvas.types.d.ts +187 -0
- package/dist/components/canvas/NodeControls.d.ts +25 -0
- package/dist/components/canvas/NodeControls.js +40 -0
- package/dist/components/canvas/NodeRenderer.d.ts +19 -0
- package/dist/components/canvas/NodeRenderer.js +117 -0
- package/dist/components/canvas/changes.d.ts +11 -0
- package/dist/components/canvas/changes.js +76 -0
- package/dist/components/canvas/context/CanvasContext.d.ts +32 -0
- package/dist/components/canvas/context/CanvasContext.js +14 -0
- package/dist/components/canvas/context/ConnectionContext.d.ts +33 -0
- package/dist/components/canvas/context/ConnectionContext.js +13 -0
- package/dist/components/canvas/context/HandleRegistry.d.ts +24 -0
- package/dist/components/canvas/context/HandleRegistry.js +15 -0
- package/dist/components/canvas/context/InteractionContext.d.ts +18 -0
- package/dist/components/canvas/context/InteractionContext.js +14 -0
- package/dist/components/canvas/context/NodeIdContext.d.ts +3 -0
- package/dist/components/canvas/context/NodeIdContext.js +15 -0
- package/dist/components/canvas/hooks/useConnection.d.ts +17 -0
- package/dist/components/canvas/hooks/useConnection.js +29 -0
- package/dist/components/canvas/hooks/useMarquee.d.ts +25 -0
- package/dist/components/canvas/hooks/useMarquee.js +91 -0
- package/dist/components/canvas/hooks/useNodeDrag.d.ts +23 -0
- package/dist/components/canvas/hooks/useNodeDrag.js +110 -0
- package/dist/components/canvas/hooks/usePanZoom.d.ts +30 -0
- package/dist/components/canvas/hooks/usePanZoom.js +189 -0
- package/dist/components/canvas/hooks/useViewport.d.ts +21 -0
- package/dist/components/canvas/hooks/useViewport.js +35 -0
- package/dist/components/canvas/index.d.ts +14 -0
- package/dist/components/canvas/index.js +12 -0
- package/dist/components/canvas/layout.d.ts +22 -0
- package/dist/components/canvas/layout.js +67 -0
- package/dist/components/canvas/utils.d.ts +4 -0
- package/dist/components/canvas/utils.js +16 -0
- package/dist/components/charts/AreaChart/AreaChart.js +136 -101
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +5 -5
- package/dist/components/charts/AreaChart/AreaChart.types.js +1 -0
- package/dist/components/charts/BarChart/BarChart.js +207 -143
- package/dist/components/charts/BarChart/BarChart.types.d.ts +4 -4
- package/dist/components/charts/BarChart/BarChart.types.js +1 -0
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +2 -2
- package/dist/components/charts/LineChart/LineChart.js +88 -72
- package/dist/components/charts/LineChart/LineChart.types.d.ts +3 -3
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.theme.js +5 -2
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +62 -72
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +10 -1
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +3 -9
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +33 -33
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +2 -2
- package/dist/components/charts/hooks/index.d.ts +2 -0
- package/dist/components/charts/hooks/useChartDimensions.d.ts +29 -0
- package/dist/components/charts/hooks/useChartDimensions.js +42 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.theme.js +1 -1
- package/dist/components/charts/types/chart.types.d.ts +11 -2
- package/dist/components/charts/types/chart.types.js +10 -3
- package/dist/components/core/Avatar/Avatar.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +4 -2
- package/dist/components/core/Badge/Badge.js +1 -1
- package/dist/components/core/Badge/Badge.theme.js +16 -15
- package/dist/components/core/Button/Button.js +1 -1
- package/dist/components/core/Button/Button.theme.js +2 -2
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Card/Card.js +7 -3
- package/dist/components/core/Card/Card.theme.js +3 -3
- package/dist/components/core/Card/Card.types.d.ts +27 -2
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenuItem.js +1 -1
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +1 -1
- package/dist/components/core/Dropdown/Dropdown.theme.js +3 -3
- package/dist/components/core/Dropdown/DropdownMenu.js +57 -29
- package/dist/components/core/HeroCard/HeroCard.d.ts +5 -0
- package/dist/components/core/HeroCard/HeroCard.js +99 -0
- package/dist/components/core/HeroCard/HeroCard.theme.d.ts +3 -0
- package/dist/components/core/HeroCard/HeroCard.theme.js +8 -0
- package/dist/components/core/HeroCard/HeroCard.types.d.ts +70 -0
- package/dist/components/core/HeroCard/index.d.ts +4 -0
- package/dist/components/core/Kbd/Kbd.theme.js +1 -1
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +2 -7
- package/dist/components/core/Modal/Modal.theme.js +4 -8
- package/dist/components/core/Modal/Modal.types.d.ts +0 -10
- package/dist/components/core/Modal/index.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.types.d.ts +1 -2
- package/dist/components/core/ModalStack/ModalStackModal.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStackModal.js +2 -7
- package/dist/components/core/PageHeading/PageHeading.theme.js +2 -2
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +242 -4
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -1
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.d.ts +4 -0
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.js +23 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.js +4 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.types.d.ts +5 -0
- package/dist/components/core/Segmented/Segmented.theme.js +2 -2
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.js +2 -0
- package/dist/components/data-display/DescriptionList/DescriptionList.js +23 -7
- package/dist/components/data-display/DescriptionList/DescriptionList.theme.js +10 -3
- package/dist/components/data-display/DescriptionList/DescriptionList.types.d.ts +49 -10
- package/dist/components/data-display/DescriptionList/index.d.ts +1 -1
- package/dist/components/data-display/Feed/Feed.js +28 -5
- package/dist/components/data-display/Feed/Feed.theme.js +1 -1
- package/dist/components/data-display/Feed/Feed.types.d.ts +32 -1
- package/dist/components/data-display/Feed/index.d.ts +1 -1
- package/dist/components/data-display/Metric/Metric.js +8 -8
- package/dist/components/data-display/Metric/Metric.theme.d.ts +3 -2
- package/dist/components/data-display/Metric/Metric.theme.js +50 -68
- package/dist/components/data-display/Metric/Metric.types.d.ts +19 -21
- package/dist/components/data-display/Table/Table.js +2 -2
- package/dist/components/data-display/Table/Table.theme.js +24 -4
- package/dist/components/data-display/Table/Table.types.d.ts +8 -0
- package/dist/components/data-display/Table/TableBody.js +2 -2
- package/dist/components/data-display/Table/TableCell.js +1 -1
- package/dist/components/data-display/Table/TableRow.d.ts +1 -1
- package/dist/components/data-display/Table/TableRow.js +9 -2
- package/dist/components/data-display/Timeline/Timeline.js +27 -5
- package/dist/components/data-display/Timeline/Timeline.theme.d.ts +10 -2
- package/dist/components/data-display/Timeline/Timeline.theme.js +14 -8
- package/dist/components/data-display/Timeline/Timeline.types.d.ts +48 -16
- package/dist/components/data-display/Timeline/Timeline.utils.d.ts +6 -0
- package/dist/components/data-display/Timeline/Timeline.utils.js +11 -0
- package/dist/components/data-display/Timeline/TimelineItem.js +13 -20
- package/dist/components/data-display/Timeline/TimelineMarker.js +10 -8
- package/dist/components/data-display/Timeline/index.d.ts +2 -2
- package/dist/components/effects/3d/index.d.ts +0 -2
- package/dist/components/effects/3d/index.js +0 -1
- package/dist/components/effects/DotPattern/DotPattern.js +1 -1
- package/dist/components/effects/Overlay/Overlay.theme.js +1 -2
- package/dist/components/effects/Preloader/Preloader.animations.d.ts +23 -0
- package/dist/components/effects/Preloader/Preloader.animations.js +150 -0
- package/dist/components/effects/Preloader/Preloader.d.ts +3 -0
- package/dist/components/effects/Preloader/Preloader.js +119 -0
- package/dist/components/effects/Preloader/Preloader.types.d.ts +63 -0
- package/dist/components/effects/Preloader/index.d.ts +2 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +25 -14
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +2 -0
- package/dist/components/effects/TiltCard/TiltCard.d.ts +12 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.d.ts +28 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.js +114 -0
- package/dist/components/effects/TiltCard/TiltCard.js +177 -0
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.d.ts → TiltCard/TiltCard.shaders.d.ts} +1 -1
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.js → TiltCard/TiltCard.shaders.js} +1 -1
- package/dist/components/effects/TiltCard/TiltCard.types.d.ts +88 -0
- package/dist/components/effects/TiltCard/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +4 -12
- package/dist/components/effects/index.js +2 -6
- package/dist/components/forms/Checkbox/Checkbox.js +7 -1
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +1 -1
- package/dist/components/forms/FileUpload/FileUpload.js +1 -89
- package/dist/components/forms/FormLabel/FormLabel.theme.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
- package/dist/components/forms/Slider/Slider.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.js +27 -15
- package/dist/components/forms/Switch/Switch.theme.d.ts +36 -6
- package/dist/components/forms/Switch/Switch.theme.js +33 -4
- package/dist/components/forms/Switch/Switch.types.d.ts +12 -2
- package/dist/components/forms/TimePicker/TimePicker.theme.js +1 -2
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -90
- package/dist/components/forms/forms.theme.js +1 -1
- package/dist/components/forms/index.d.ts +0 -4
- package/dist/components/forms/index.js +0 -92
- package/dist/components/generative/GenerativeView.d.ts +21 -0
- package/dist/components/generative/GenerativeView.js +116 -0
- package/dist/components/generative/actions.d.ts +26 -0
- package/dist/components/generative/actions.js +51 -0
- package/dist/components/generative/index.d.ts +11 -0
- package/dist/components/generative/index.js +9 -0
- package/dist/components/generative/registry.d.ts +43 -0
- package/dist/components/generative/registry.js +114 -0
- package/dist/components/generative/resolvers.d.ts +35 -0
- package/dist/components/generative/resolvers.js +93 -0
- package/dist/components/generative/schema.generated.d.ts +2 -0
- package/dist/components/generative/schema.generated.js +1639 -0
- package/dist/components/generative/schemaTypes.d.ts +30 -0
- package/dist/components/generative/streaming.d.ts +39 -0
- package/dist/components/generative/streaming.js +283 -0
- package/dist/components/generative/tools.d.ts +21 -0
- package/dist/components/generative/tools.js +54 -0
- package/dist/components/generative/types.d.ts +41 -0
- package/dist/components/generative/useGenerativeStream.d.ts +37 -0
- package/dist/components/generative/useGenerativeStream.js +36 -0
- package/dist/components/generative/validate.d.ts +24 -0
- package/dist/components/generative/validate.js +259 -0
- package/dist/components/layout/AppShell/AppShell.theme.js +2 -2
- package/dist/components/layout/FormLayout/FormLayout.js +1 -90
- package/dist/components/layout/Grid/Grid.d.ts +3 -0
- package/dist/components/layout/Grid/Grid.js +50 -0
- package/dist/components/layout/Grid/Grid.theme.d.ts +2 -0
- package/dist/components/layout/Grid/Grid.theme.js +35 -0
- package/dist/components/layout/Grid/Grid.types.d.ts +57 -0
- package/dist/components/layout/Grid/index.d.ts +3 -0
- package/dist/components/layout/Section/Section.d.ts +3 -0
- package/dist/components/layout/Section/Section.js +18 -0
- package/dist/components/layout/Section/Section.theme.d.ts +2 -0
- package/dist/components/layout/Section/Section.theme.js +10 -0
- package/dist/components/layout/Section/Section.types.d.ts +34 -0
- package/dist/components/layout/Section/index.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.js +19 -0
- package/dist/components/layout/Stack/Stack.theme.d.ts +2 -0
- package/dist/components/layout/Stack/Stack.theme.js +10 -0
- package/dist/components/layout/Stack/Stack.types.d.ts +39 -0
- package/dist/components/layout/Stack/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +6 -0
- package/dist/generative.schema.json +1637 -0
- package/dist/index.js +180 -180
- package/dist/registry.json +648 -464
- package/dist/styles.css +1 -1
- package/dist/tools.json +1731 -0
- package/package.json +17 -4
- package/src/global.scss +53 -101
- package/src/styles/theme.css +687 -493
- package/dist/bg/1.jpg +0 -0
- package/dist/bg/10.jpg +0 -0
- package/dist/bg/11.jpg +0 -0
- package/dist/bg/14.jpg +0 -0
- package/dist/bg/15.jpg +0 -0
- package/dist/bg/16.jpg +0 -0
- package/dist/bg/17.jpg +0 -0
- package/dist/bg/18.jpg +0 -0
- package/dist/bg/19.jpg +0 -0
- package/dist/bg/2.jpg +0 -0
- package/dist/bg/20.jpg +0 -0
- package/dist/bg/21.jpg +0 -0
- package/dist/bg/22.jpg +0 -0
- package/dist/bg/23.jpg +0 -0
- package/dist/bg/24.jpg +0 -0
- package/dist/bg/3.jpg +0 -0
- package/dist/bg/4.jpg +0 -0
- package/dist/bg/5.jpg +0 -0
- package/dist/bg/6.jpg +0 -0
- package/dist/bg/7.jpg +0 -0
- package/dist/bg/8.jpg +0 -0
- package/dist/bg/9.jpg +0 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +0 -17
- package/dist/components/effects/MorphingText/MorphingText.js +0 -125
- package/dist/components/effects/MorphingText/MorphingText.types.d.ts +0 -18
- package/dist/components/effects/MorphingText/index.d.ts +0 -2
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +0 -8
- package/dist/components/effects/PageTransition/PageTransition.animations.js +0 -53
- package/dist/components/effects/PageTransition/PageTransition.d.ts +0 -3
- package/dist/components/effects/PageTransition/PageTransition.js +0 -82
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +0 -15
- package/dist/components/effects/PageTransition/index.d.ts +0 -2
- package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +0 -26
- package/dist/components/effects/ParallaxSection/ParallaxSection.js +0 -71
- package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +0 -11
- package/dist/components/effects/ParallaxSection/index.d.ts +0 -2
- package/dist/components/effects/Spotlight/Spotlight.d.ts +0 -36
- package/dist/components/effects/Spotlight/Spotlight.js +0 -112
- package/dist/components/effects/Spotlight/Spotlight.types.d.ts +0 -29
- package/dist/components/effects/Spotlight/index.d.ts +0 -2
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.d.ts +0 -18
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.js +0 -213
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.types.d.ts +0 -61
- package/dist/components/effects/SpotlightBorder/index.d.ts +0 -2
- package/dist/components/effects/StickyScroll/StickyScroll.d.ts +0 -30
- package/dist/components/effects/StickyScroll/StickyScroll.js +0 -128
- package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +0 -19
- package/dist/components/effects/StickyScroll/index.d.ts +0 -2
- package/dist/components/forms/CronInput/CronInput.d.ts +0 -3
- package/dist/components/forms/CronInput/CronInput.js +0 -113
- package/dist/components/forms/CronInput/CronInput.theme.d.ts +0 -6
- package/dist/components/forms/CronInput/CronInput.theme.js +0 -75
- package/dist/components/forms/CronInput/CronInput.types.d.ts +0 -109
- package/dist/components/forms/CronInput/CronInput.utils.d.ts +0 -67
- package/dist/components/forms/CronInput/CronInput.utils.js +0 -505
- package/dist/components/forms/CronInput/index.d.ts +0 -4
- /package/dist/components/effects/{SpotlightBorder/SpotlightBorder.types.js → TiltCard/TiltCard.types.js} +0 -0
|
@@ -24,27 +24,27 @@ const GRADIENT_DIRECTIONS = {
|
|
|
24
24
|
*/
|
|
25
25
|
const BlurInstance = forwardRef(({ position, blurLevels, size, theme, className, style, ...rest }, ref) => {
|
|
26
26
|
const isVertical = position === "top" || position === "bottom";
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...style,
|
|
32
|
-
};
|
|
33
|
-
return (jsx("div", { ref: ref, className: cn(theme.baseStyle, theme.positions[position], className), style: containerStyle, ...rest, children: blurLevels.map((blur, i) => {
|
|
27
|
+
const layerStyles = useMemo(() => {
|
|
28
|
+
const direction = GRADIENT_DIRECTIONS[position];
|
|
29
|
+
const step = 100 / blurLevels.length;
|
|
30
|
+
return blurLevels.map((blur, i) => {
|
|
34
31
|
// MagicUI mask formula: each layer has a 1-step fade-in, 1-step solid,
|
|
35
32
|
// and 1-step fade-out. Adjacent layers overlap by 2 steps, creating
|
|
36
33
|
// smooth transitions. Values beyond 100% are clamped by the browser.
|
|
37
|
-
const step = 100 / n;
|
|
38
34
|
const gradient = `linear-gradient(${direction}, transparent ${i * step}%, black ${(i + 1) * step}%, black ${(i + 2) * step}%, transparent ${(i + 3) * step}%)`;
|
|
39
|
-
|
|
35
|
+
return {
|
|
40
36
|
maskImage: gradient,
|
|
41
37
|
WebkitMaskImage: gradient,
|
|
42
38
|
backdropFilter: `blur(${blur}px)`,
|
|
43
39
|
WebkitBackdropFilter: `blur(${blur}px)`,
|
|
44
|
-
zIndex: i + 1,
|
|
45
40
|
};
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
});
|
|
42
|
+
}, [position, blurLevels]);
|
|
43
|
+
const containerStyle = {
|
|
44
|
+
...(isVertical ? { height: size } : { width: size }),
|
|
45
|
+
...style,
|
|
46
|
+
};
|
|
47
|
+
return (jsx("div", { ref: ref, "aria-hidden": "true", className: cn(theme.baseStyle, theme.positions[position], className), style: containerStyle, ...rest, children: layerStyles.map((layerStyle, i) => (jsx("div", { className: theme.layerStyle, style: layerStyle }, i))) }));
|
|
48
48
|
});
|
|
49
49
|
BlurInstance.displayName = "BlurInstance";
|
|
50
50
|
const ProgressiveBlur = forwardRef(({ position = "bottom", blurLevels: blurLevelsProp, layers = DEFAULT_LAYERS, blurIntensity = DEFAULT_MAX_BLUR, size = DEFAULT_SIZE, className, theme: themeOverrides, ...rest }, ref) => {
|
|
@@ -59,10 +59,21 @@ const ProgressiveBlur = forwardRef(({ position = "bottom", blurLevels: blurLevel
|
|
|
59
59
|
layerStyle: (_b = themeOverrides === null || themeOverrides === void 0 ? void 0 : themeOverrides.layerStyle) !== null && _b !== void 0 ? _b : progressiveBlurTheme.layerStyle,
|
|
60
60
|
});
|
|
61
61
|
}, [themeOverrides]);
|
|
62
|
-
const blurLevels = useMemo(() =>
|
|
62
|
+
const blurLevels = useMemo(() => {
|
|
63
|
+
if (blurLevelsProp)
|
|
64
|
+
return blurLevelsProp;
|
|
65
|
+
const count = Math.max(1, Math.floor(layers));
|
|
66
|
+
if (process.env.NODE_ENV !== "production" && count !== layers) {
|
|
67
|
+
console.warn(`[ProgressiveBlur]: \`layers\` must be a positive integer; received ${layers}, using ${count}.`);
|
|
68
|
+
}
|
|
69
|
+
return generateBlurLevels(count, blurIntensity);
|
|
70
|
+
}, [blurLevelsProp, layers, blurIntensity]);
|
|
63
71
|
const positions = Array.isArray(position)
|
|
64
|
-
? position
|
|
72
|
+
? Array.from(new Set(position))
|
|
65
73
|
: [position];
|
|
74
|
+
if (process.env.NODE_ENV !== "production" && ref && positions.length > 1) {
|
|
75
|
+
console.warn("[ProgressiveBlur]: `ref` is ignored when `position` is an array — render one ProgressiveBlur per position if you need element refs.");
|
|
76
|
+
}
|
|
66
77
|
// Single position — render directly, forward ref and remaining props
|
|
67
78
|
if (positions.length === 1) {
|
|
68
79
|
return (jsx(BlurInstance, { ref: ref, position: positions[0], blurLevels: blurLevels, size: size, theme: theme, className: className, ...rest }));
|
|
@@ -4,6 +4,8 @@ export interface ProgressiveBlurProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
4
4
|
/**
|
|
5
5
|
* Position(s) where the blur effect should be applied.
|
|
6
6
|
* Can be a single position or array of positions.
|
|
7
|
+
* With an array, one element renders per position, so `ref` is not
|
|
8
|
+
* forwarded and `id`/event props apply to every instance.
|
|
7
9
|
* @default "bottom"
|
|
8
10
|
*/
|
|
9
11
|
position?: ProgressiveBlurPosition | ProgressiveBlurPosition[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TiltCardProps } from "./TiltCard.types";
|
|
3
|
+
/**
|
|
4
|
+
* TiltCard wraps content in a damped 3D mouse tilt. The tilt is a pure CSS
|
|
5
|
+
* transform — no WebGL. The optional `glow` spotlight border lazy-loads the
|
|
6
|
+
* `three` peer dependency on demand (see TiltCard.glow.ts).
|
|
7
|
+
*
|
|
8
|
+
* The animation loop is demand-driven: it runs only while the pointer is near
|
|
9
|
+
* the card or the damped values are still settling, then stops — an idle
|
|
10
|
+
* TiltCard costs nothing per frame.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TiltCard: React.FC<TiltCardProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type TiltCardVariation } from "./TiltCard.types";
|
|
2
|
+
/**
|
|
3
|
+
* WebGL spotlight-border renderer for TiltCard. Kept in its own module so the
|
|
4
|
+
* `three` optional peer dependency is only loaded (dynamic import) when a
|
|
5
|
+
* TiltCard actually enables `glow` — tilt-only cards never touch WebGL.
|
|
6
|
+
*/
|
|
7
|
+
export interface GlowParams {
|
|
8
|
+
glowColor: string;
|
|
9
|
+
spotlightSize: number;
|
|
10
|
+
spotlightEdge: number;
|
|
11
|
+
glowIntensity: number;
|
|
12
|
+
borderWidth: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GlowEffect {
|
|
15
|
+
/** Render one frame with the damped mouse position (content-local px). */
|
|
16
|
+
render(mouseX: number, mouseY: number): void;
|
|
17
|
+
/** Re-measure the content box and update sizes/uniforms. */
|
|
18
|
+
resize(): void;
|
|
19
|
+
setParams(params: GlowParams): void;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
22
|
+
export declare function createGlowEffect(opts: {
|
|
23
|
+
host: HTMLElement;
|
|
24
|
+
content: HTMLElement;
|
|
25
|
+
variation: TiltCardVariation;
|
|
26
|
+
glowExtent: number;
|
|
27
|
+
rounded?: string;
|
|
28
|
+
}): GlowEffect;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { fragmentShader, vertexShader } from './TiltCard.shaders.js';
|
|
3
|
+
import { variationMap } from './TiltCard.types.js';
|
|
4
|
+
|
|
5
|
+
function createGlowEffect(opts) {
|
|
6
|
+
var _a;
|
|
7
|
+
const { host, content, variation, glowExtent, rounded } = opts;
|
|
8
|
+
const scene = new THREE.Scene();
|
|
9
|
+
const camera = new THREE.OrthographicCamera();
|
|
10
|
+
camera.position.z = 1;
|
|
11
|
+
const renderer = new THREE.WebGLRenderer({ alpha: true });
|
|
12
|
+
renderer.setClearColor(0x000000, 0);
|
|
13
|
+
const canvas = renderer.domElement;
|
|
14
|
+
canvas.style.position = "absolute";
|
|
15
|
+
canvas.style.pointerEvents = "none";
|
|
16
|
+
canvas.style.zIndex = "10";
|
|
17
|
+
host.appendChild(canvas);
|
|
18
|
+
const geo = new THREE.PlaneGeometry(1, 1);
|
|
19
|
+
const material = new THREE.ShaderMaterial({
|
|
20
|
+
vertexShader,
|
|
21
|
+
fragmentShader,
|
|
22
|
+
uniforms: {
|
|
23
|
+
u_mouse: { value: new THREE.Vector2(-1e4, -1e4) },
|
|
24
|
+
u_resolution: { value: new THREE.Vector2() },
|
|
25
|
+
u_contentResolution: { value: new THREE.Vector2() },
|
|
26
|
+
u_offset: { value: new THREE.Vector2() },
|
|
27
|
+
u_pixelRatio: { value: 1 },
|
|
28
|
+
u_color: { value: new THREE.Color("#ffffff") },
|
|
29
|
+
u_shapeSize: { value: 1.0 },
|
|
30
|
+
u_roundness: { value: 0.0 },
|
|
31
|
+
u_borderSize: { value: 0.0 },
|
|
32
|
+
u_spotlightSize: { value: 0.4 },
|
|
33
|
+
u_spotlightEdge: { value: 0.5 },
|
|
34
|
+
u_glowIntensity: { value: 0.6 },
|
|
35
|
+
},
|
|
36
|
+
defines: { VAR: (_a = variationMap[variation]) !== null && _a !== void 0 ? _a : 0 },
|
|
37
|
+
transparent: true,
|
|
38
|
+
});
|
|
39
|
+
const quad = new THREE.Mesh(geo, material);
|
|
40
|
+
scene.add(quad);
|
|
41
|
+
let borderWidthPx = 2;
|
|
42
|
+
let contextLost = false;
|
|
43
|
+
const onContextLost = (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
contextLost = true;
|
|
46
|
+
};
|
|
47
|
+
const onContextRestored = () => {
|
|
48
|
+
contextLost = false;
|
|
49
|
+
resize();
|
|
50
|
+
};
|
|
51
|
+
canvas.addEventListener("webglcontextlost", onContextLost);
|
|
52
|
+
canvas.addEventListener("webglcontextrestored", onContextRestored);
|
|
53
|
+
const resize = () => {
|
|
54
|
+
var _a;
|
|
55
|
+
const w = content.clientWidth;
|
|
56
|
+
const h = content.clientHeight;
|
|
57
|
+
if (w === 0 || h === 0)
|
|
58
|
+
return;
|
|
59
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
60
|
+
const canvasW = w + glowExtent * 2;
|
|
61
|
+
const canvasH = h + glowExtent * 2;
|
|
62
|
+
renderer.setSize(canvasW, canvasH);
|
|
63
|
+
renderer.setPixelRatio(dpr);
|
|
64
|
+
canvas.style.top = `-${glowExtent}px`;
|
|
65
|
+
canvas.style.left = `-${glowExtent}px`;
|
|
66
|
+
canvas.style.width = `${canvasW}px`;
|
|
67
|
+
canvas.style.height = `${canvasH}px`;
|
|
68
|
+
camera.left = -canvasW / 2;
|
|
69
|
+
camera.right = canvasW / 2;
|
|
70
|
+
camera.top = canvasH / 2;
|
|
71
|
+
camera.bottom = -canvasH / 2;
|
|
72
|
+
camera.updateProjectionMatrix();
|
|
73
|
+
quad.scale.set(canvasW, canvasH, 1);
|
|
74
|
+
material.uniforms.u_resolution.value.set(canvasW, canvasH).multiplyScalar(dpr);
|
|
75
|
+
material.uniforms.u_contentResolution.value.set(w, h).multiplyScalar(dpr);
|
|
76
|
+
material.uniforms.u_offset.value.set(glowExtent, glowExtent).multiplyScalar(dpr);
|
|
77
|
+
material.uniforms.u_pixelRatio.value = dpr;
|
|
78
|
+
const shortestDim = Math.min(w, h);
|
|
79
|
+
const radiusSource = rounded ? host : ((_a = content.firstElementChild) !== null && _a !== void 0 ? _a : host);
|
|
80
|
+
const radiusPx = parseFloat(getComputedStyle(radiusSource).borderRadius) || 0;
|
|
81
|
+
material.uniforms.u_roundness.value = Math.min((radiusPx / shortestDim) * 2, 1);
|
|
82
|
+
material.uniforms.u_borderSize.value = borderWidthPx / shortestDim;
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
render(mouseX, mouseY) {
|
|
86
|
+
if (contextLost)
|
|
87
|
+
return;
|
|
88
|
+
material.uniforms.u_mouse.value.set(mouseX, mouseY);
|
|
89
|
+
renderer.render(scene, camera);
|
|
90
|
+
},
|
|
91
|
+
resize,
|
|
92
|
+
setParams({ glowColor, spotlightSize, spotlightEdge, glowIntensity, borderWidth }) {
|
|
93
|
+
material.uniforms.u_color.value.set(glowColor);
|
|
94
|
+
material.uniforms.u_spotlightSize.value = spotlightSize;
|
|
95
|
+
material.uniforms.u_spotlightEdge.value = spotlightEdge;
|
|
96
|
+
material.uniforms.u_glowIntensity.value = glowIntensity;
|
|
97
|
+
borderWidthPx = borderWidth;
|
|
98
|
+
const shortestDim = Math.min(content.clientWidth, content.clientHeight);
|
|
99
|
+
if (shortestDim > 0)
|
|
100
|
+
material.uniforms.u_borderSize.value = borderWidthPx / shortestDim;
|
|
101
|
+
},
|
|
102
|
+
dispose() {
|
|
103
|
+
canvas.removeEventListener("webglcontextlost", onContextLost);
|
|
104
|
+
canvas.removeEventListener("webglcontextrestored", onContextRestored);
|
|
105
|
+
if (host.contains(canvas))
|
|
106
|
+
host.removeChild(canvas);
|
|
107
|
+
renderer.dispose();
|
|
108
|
+
geo.dispose();
|
|
109
|
+
material.dispose();
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { createGlowEffect };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { useReducedMotion } from 'motion/react';
|
|
4
|
+
import { cn } from '../../../utils/cn.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TiltCard wraps content in a damped 3D mouse tilt. The tilt is a pure CSS
|
|
8
|
+
* transform — no WebGL. The optional `glow` spotlight border lazy-loads the
|
|
9
|
+
* `three` peer dependency on demand (see TiltCard.glow.ts).
|
|
10
|
+
*
|
|
11
|
+
* The animation loop is demand-driven: it runs only while the pointer is near
|
|
12
|
+
* the card or the damped values are still settling, then stops — an idle
|
|
13
|
+
* TiltCard costs nothing per frame.
|
|
14
|
+
*/
|
|
15
|
+
const TiltCard = ({ children, tiltIntensity = 6, glow = false, variation = "rounded-rect", rounded, borderWidth = 2, glowColor = "#ffffff", spotlightSize = 0.4, spotlightEdge = 0.5, glowExtent = 20, glowIntensity = 0.6, shouldAnimate = true, className, style, ...props }) => {
|
|
16
|
+
const outerRef = useRef(null);
|
|
17
|
+
const contentRef = useRef(null);
|
|
18
|
+
const glowRef = useRef(null);
|
|
19
|
+
// Loop reads live prop values from refs so prop changes never tear down WebGL
|
|
20
|
+
const tiltRef = useRef(tiltIntensity);
|
|
21
|
+
tiltRef.current = tiltIntensity;
|
|
22
|
+
const glowParamsRef = useRef({ glowColor, spotlightSize, spotlightEdge, glowIntensity, borderWidth });
|
|
23
|
+
glowParamsRef.current = { glowColor, spotlightSize, spotlightEdge, glowIntensity, borderWidth };
|
|
24
|
+
// useReducedMotion is SSR-safe (null on server, real value after hydration)
|
|
25
|
+
const prefersReducedMotion = useReducedMotion();
|
|
26
|
+
const isAnimating = shouldAnimate && !prefersReducedMotion;
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const outer = outerRef.current;
|
|
29
|
+
const content = contentRef.current;
|
|
30
|
+
if (!outer || !content || !isAnimating)
|
|
31
|
+
return;
|
|
32
|
+
let disposed = false;
|
|
33
|
+
// Pointer in client coords — the handler does NO layout reads; the loop
|
|
34
|
+
// converts to content-local with one getBoundingClientRect per frame.
|
|
35
|
+
let pointer = null;
|
|
36
|
+
let cachedRect = null;
|
|
37
|
+
const st = { mx: -1e4, my: -1e4, dmx: -1e4, dmy: -1e4, rx: 0, ry: 0, raf: 0, running: false, last: 0 };
|
|
38
|
+
// How far outside the card the pointer still matters (glow lights up on approach)
|
|
39
|
+
const proximity = glow ? Math.max(glowExtent * 3, 120) : 0;
|
|
40
|
+
const loop = (now) => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (disposed)
|
|
43
|
+
return;
|
|
44
|
+
const dt = Math.min(Math.max((now - st.last) / 1000, 0.001), 0.05);
|
|
45
|
+
st.last = now;
|
|
46
|
+
const rect = content.getBoundingClientRect();
|
|
47
|
+
cachedRect = rect;
|
|
48
|
+
if (pointer) {
|
|
49
|
+
const nx = pointer.x - rect.left;
|
|
50
|
+
const ny = pointer.y - rect.top;
|
|
51
|
+
// First arrival: snap the damped position instead of easing in from the
|
|
52
|
+
// far-away sentinel (easing from -10000 produces a violent tilt/glow sweep)
|
|
53
|
+
if (st.mx <= -9e3) {
|
|
54
|
+
st.dmx = nx;
|
|
55
|
+
st.dmy = ny;
|
|
56
|
+
}
|
|
57
|
+
st.mx = nx;
|
|
58
|
+
st.my = ny;
|
|
59
|
+
}
|
|
60
|
+
// dt-normalized damping — same feel at 60Hz and 120Hz
|
|
61
|
+
const aMouse = 1 - Math.exp(-12 * dt);
|
|
62
|
+
st.dmx += (st.mx - st.dmx) * aMouse;
|
|
63
|
+
st.dmy += (st.my - st.dmy) * aMouse;
|
|
64
|
+
const w = rect.width;
|
|
65
|
+
const h = rect.height;
|
|
66
|
+
// Gate on the DAMPED position — the tilt target derives from it, so the
|
|
67
|
+
// gate and the target must agree or transient positions leak through
|
|
68
|
+
const inside = !!pointer && st.dmx >= 0 && st.dmx <= w && st.dmy >= 0 && st.dmy <= h;
|
|
69
|
+
let targetRX = 0;
|
|
70
|
+
let targetRY = 0;
|
|
71
|
+
if (tiltRef.current > 0 && inside && w > 0 && h > 0) {
|
|
72
|
+
targetRY = (st.dmx / w - 0.5) * tiltRef.current;
|
|
73
|
+
targetRX = -(st.dmy / h - 0.5) * tiltRef.current;
|
|
74
|
+
}
|
|
75
|
+
const aTilt = 1 - Math.exp(-10 * dt);
|
|
76
|
+
st.rx += (targetRX - st.rx) * aTilt;
|
|
77
|
+
st.ry += (targetRY - st.ry) * aTilt;
|
|
78
|
+
const settledFlat = Math.abs(st.rx) < 0.01 && Math.abs(st.ry) < 0.01 && !inside;
|
|
79
|
+
outer.style.transform = settledFlat
|
|
80
|
+
? ""
|
|
81
|
+
: `perspective(1000px) rotateX(${st.rx}deg) rotateY(${st.ry}deg)`;
|
|
82
|
+
(_a = glowRef.current) === null || _a === void 0 ? void 0 : _a.render(st.dmx, st.dmy);
|
|
83
|
+
// Idle detection: stop once everything converged — a motionless hover
|
|
84
|
+
// renders nothing new. Any pointermove (or leave) restarts the loop.
|
|
85
|
+
const mouseSettled = Math.abs(st.mx - st.dmx) < 0.1 && Math.abs(st.my - st.dmy) < 0.1;
|
|
86
|
+
const tiltSettled = Math.abs(targetRX - st.rx) < 0.005 && Math.abs(targetRY - st.ry) < 0.005;
|
|
87
|
+
if (mouseSettled && tiltSettled) {
|
|
88
|
+
st.running = false;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
st.raf = requestAnimationFrame(loop);
|
|
92
|
+
};
|
|
93
|
+
const start = () => {
|
|
94
|
+
if (st.running || disposed)
|
|
95
|
+
return;
|
|
96
|
+
st.running = true;
|
|
97
|
+
st.last = performance.now();
|
|
98
|
+
st.raf = requestAnimationFrame(loop);
|
|
99
|
+
};
|
|
100
|
+
const onPointerMove = (e) => {
|
|
101
|
+
pointer = { x: e.clientX, y: e.clientY };
|
|
102
|
+
if (proximity > 0) {
|
|
103
|
+
// Document-level listener (glow reacts on approach): cheap pre-check
|
|
104
|
+
// against the cached rect so far-away moves don't wake the loop.
|
|
105
|
+
if (!cachedRect)
|
|
106
|
+
cachedRect = content.getBoundingClientRect();
|
|
107
|
+
const r = cachedRect;
|
|
108
|
+
if (e.clientX < r.left - proximity ||
|
|
109
|
+
e.clientX > r.right + proximity ||
|
|
110
|
+
e.clientY < r.top - proximity ||
|
|
111
|
+
e.clientY > r.bottom + proximity)
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
start();
|
|
115
|
+
};
|
|
116
|
+
const onPointerLeave = () => {
|
|
117
|
+
pointer = null;
|
|
118
|
+
st.mx = -1e4;
|
|
119
|
+
st.my = -1e4;
|
|
120
|
+
start(); // let the tilt ease back to rest, then the loop self-stops
|
|
121
|
+
};
|
|
122
|
+
const invalidateRect = () => {
|
|
123
|
+
cachedRect = null;
|
|
124
|
+
};
|
|
125
|
+
// Tilt-only: element-scoped listeners. Glow: document-scoped (the border
|
|
126
|
+
// lights up as the cursor approaches from outside).
|
|
127
|
+
const moveTarget = glow ? document : outer;
|
|
128
|
+
moveTarget.addEventListener("pointermove", onPointerMove, { passive: true });
|
|
129
|
+
const leaveTarget = glow ? document.documentElement : outer;
|
|
130
|
+
leaveTarget.addEventListener("pointerleave", onPointerLeave);
|
|
131
|
+
window.addEventListener("scroll", invalidateRect, { passive: true, capture: true });
|
|
132
|
+
const ro = new ResizeObserver(() => {
|
|
133
|
+
var _a;
|
|
134
|
+
invalidateRect();
|
|
135
|
+
(_a = glowRef.current) === null || _a === void 0 ? void 0 : _a.resize();
|
|
136
|
+
start(); // re-render the glow at the new size, then settle
|
|
137
|
+
});
|
|
138
|
+
ro.observe(content);
|
|
139
|
+
if (glow) {
|
|
140
|
+
import('./TiltCard.glow.js')
|
|
141
|
+
.then(({ createGlowEffect }) => {
|
|
142
|
+
if (disposed)
|
|
143
|
+
return;
|
|
144
|
+
const effect = createGlowEffect({ host: outer, content, variation, glowExtent, rounded });
|
|
145
|
+
effect.setParams(glowParamsRef.current);
|
|
146
|
+
effect.resize();
|
|
147
|
+
glowRef.current = effect;
|
|
148
|
+
start();
|
|
149
|
+
})
|
|
150
|
+
.catch((err) => {
|
|
151
|
+
if (process.env.NODE_ENV !== "production") {
|
|
152
|
+
console.error('[TiltCard] `glow` requires the optional "three" peer dependency.', err);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return () => {
|
|
157
|
+
var _a;
|
|
158
|
+
disposed = true;
|
|
159
|
+
moveTarget.removeEventListener("pointermove", onPointerMove);
|
|
160
|
+
leaveTarget.removeEventListener("pointerleave", onPointerLeave);
|
|
161
|
+
window.removeEventListener("scroll", invalidateRect, { capture: true });
|
|
162
|
+
ro.disconnect();
|
|
163
|
+
cancelAnimationFrame(st.raf);
|
|
164
|
+
outer.style.transform = "";
|
|
165
|
+
(_a = glowRef.current) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
166
|
+
glowRef.current = null;
|
|
167
|
+
};
|
|
168
|
+
}, [isAnimating, glow, variation, glowExtent, rounded]);
|
|
169
|
+
// Live-update glow uniforms without tearing down the WebGL context
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
var _a;
|
|
172
|
+
(_a = glowRef.current) === null || _a === void 0 ? void 0 : _a.setParams({ glowColor, spotlightSize, spotlightEdge, glowIntensity, borderWidth });
|
|
173
|
+
}, [glowColor, spotlightSize, spotlightEdge, glowIntensity, borderWidth]);
|
|
174
|
+
return (jsx("div", { ref: outerRef, className: cn("relative overflow-visible", className), style: { ...style, ...(rounded ? { borderRadius: rounded } : {}) }, ...props, children: jsx("div", { ref: contentRef, className: "relative h-full w-full", style: { borderRadius: "inherit", zIndex: 20 }, children: children }) }));
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { TiltCard };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type TiltCardVariation = "rounded-rect" | "circle" | "circle-ring" | "triangle";
|
|
3
|
+
export declare const variationMap: Record<TiltCardVariation, number>;
|
|
4
|
+
/**
|
|
5
|
+
* TiltCard — wraps content in a damped 3D mouse tilt (pure CSS transform,
|
|
6
|
+
* no WebGL cost), with an optional `glow` spotlight border (lazy-loads the
|
|
7
|
+
* `three` optional peer dependency only when enabled).
|
|
8
|
+
*
|
|
9
|
+
* @example Tilt only — cheap, no WebGL
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <TiltCard tiltIntensity={6}>
|
|
12
|
+
* <Card>…</Card>
|
|
13
|
+
* </TiltCard>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example With the spotlight border glow
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <TiltCard glow glowColor="#3b82f6" borderWidth={2} glowExtent={30}>
|
|
19
|
+
* <Card className="bg-gray-900">…</Card>
|
|
20
|
+
* </TiltCard>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface TiltCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
/** Content to wrap with the effect */
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Max tilt in degrees as the mouse moves across the card. 0 disables the tilt.
|
|
28
|
+
* @default 6
|
|
29
|
+
*/
|
|
30
|
+
tiltIntensity?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Enable the WebGL spotlight border (illuminates near the cursor with a soft
|
|
33
|
+
* outer glow). Lazy-loads `three` — without it, TiltCard never touches WebGL.
|
|
34
|
+
* ⚠️ Each glowing instance owns a WebGL context; browsers cap ~8–16 live
|
|
35
|
+
* contexts, so avoid enabling it on large collections of cards.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
glow?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Shape variation for the glow border
|
|
41
|
+
* @default 'rounded-rect'
|
|
42
|
+
*/
|
|
43
|
+
variation?: TiltCardVariation;
|
|
44
|
+
/**
|
|
45
|
+
* Border radius for the container (e.g., "1rem", "var(--card-radius)").
|
|
46
|
+
* Controls both the container clip and the shader's corner roundness.
|
|
47
|
+
* @default undefined (inherits from className like rounded-xl)
|
|
48
|
+
*/
|
|
49
|
+
rounded?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Glow border stroke width in pixels
|
|
52
|
+
* @default 2
|
|
53
|
+
*/
|
|
54
|
+
borderWidth?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Color of the glow border (any CSS color three.js can parse)
|
|
57
|
+
* @default '#ffffff'
|
|
58
|
+
*/
|
|
59
|
+
glowColor?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Size of the mouse-following spotlight (0-1)
|
|
62
|
+
* @default 0.4
|
|
63
|
+
*/
|
|
64
|
+
spotlightSize?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Edge softness of the spotlight (higher = softer falloff)
|
|
67
|
+
* @default 0.5
|
|
68
|
+
*/
|
|
69
|
+
spotlightEdge?: number;
|
|
70
|
+
/**
|
|
71
|
+
* How far the glow can spread outside the container in pixels.
|
|
72
|
+
* Also prevents clipping of child shadows.
|
|
73
|
+
* @default 20
|
|
74
|
+
*/
|
|
75
|
+
glowExtent?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Overall intensity of the glow halo (0-1)
|
|
78
|
+
* @default 0.6
|
|
79
|
+
*/
|
|
80
|
+
glowIntensity?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to animate (respects prefers-reduced-motion)
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
shouldAnimate?: boolean;
|
|
86
|
+
/** Additional className for the container */
|
|
87
|
+
className?: string;
|
|
88
|
+
}
|
|
@@ -14,8 +14,6 @@ export { Aurora } from "./Aurora";
|
|
|
14
14
|
export type { AuroraProps } from "./Aurora";
|
|
15
15
|
export { MagneticElement } from "./MagneticElement";
|
|
16
16
|
export type { MagneticElementProps } from "./MagneticElement";
|
|
17
|
-
export { MorphingText } from "./MorphingText";
|
|
18
|
-
export type { MorphingTextProps } from "./MorphingText";
|
|
19
17
|
export { GridPattern } from "./GridPattern";
|
|
20
18
|
export type { GridPatternProps, GridPatternFadeDirection, } from "./GridPattern";
|
|
21
19
|
export { DotPattern } from "./DotPattern";
|
|
@@ -24,18 +22,12 @@ export { StripePattern } from "./StripePattern";
|
|
|
24
22
|
export type { StripePatternProps, StripePatternFadeDirection, } from "./StripePattern";
|
|
25
23
|
export { NoiseOverlay } from "./NoiseOverlay";
|
|
26
24
|
export type { NoiseOverlayProps, NoiseBlendMode } from "./NoiseOverlay";
|
|
27
|
-
export {
|
|
28
|
-
export type {
|
|
29
|
-
export { SpotlightBorder } from "./SpotlightBorder";
|
|
30
|
-
export type { SpotlightBorderProps, SpotlightBorderVariation, } from "./SpotlightBorder";
|
|
31
|
-
export { ParallaxSection } from "./ParallaxSection";
|
|
32
|
-
export type { ParallaxSectionProps } from "./ParallaxSection";
|
|
25
|
+
export { TiltCard } from "./TiltCard";
|
|
26
|
+
export type { TiltCardProps, TiltCardVariation } from "./TiltCard";
|
|
33
27
|
export { ScrollReveal } from "./ScrollReveal";
|
|
34
28
|
export type { ScrollRevealProps, ScrollRevealPreset } from "./ScrollReveal";
|
|
35
|
-
export {
|
|
36
|
-
export type {
|
|
37
|
-
export { PageTransition } from "./PageTransition";
|
|
38
|
-
export type { PageTransitionProps, PageTransitionDirection, } from "./PageTransition";
|
|
29
|
+
export { Preloader } from "./Preloader";
|
|
30
|
+
export type { PreloaderProps, PreloaderDirection, PreloaderType, } from "./Preloader";
|
|
39
31
|
export { InteractiveCharacters } from "./InteractiveCharacters";
|
|
40
32
|
export type { InteractiveCharactersProps, CharacterState, CharacterSize, } from "./InteractiveCharacters";
|
|
41
33
|
export { InsetCircleButton, InsetPill } from "./Neumorphic";
|
|
@@ -6,17 +6,13 @@ export { Animated } from './Animated/Animated.js';
|
|
|
6
6
|
export { ProgressiveBlur } from './ProgressiveBlur/ProgressiveBlur.js';
|
|
7
7
|
export { Aurora } from './Aurora/Aurora.js';
|
|
8
8
|
export { MagneticElement } from './MagneticElement/MagneticElement.js';
|
|
9
|
-
export { MorphingText } from './MorphingText/MorphingText.js';
|
|
10
9
|
export { GridPattern } from './GridPattern/GridPattern.js';
|
|
11
10
|
export { DotPattern } from './DotPattern/DotPattern.js';
|
|
12
11
|
export { StripePattern } from './StripePattern/StripePattern.js';
|
|
13
12
|
export { NoiseOverlay } from './NoiseOverlay/NoiseOverlay.js';
|
|
14
|
-
export {
|
|
15
|
-
export { SpotlightBorder } from './SpotlightBorder/SpotlightBorder.js';
|
|
16
|
-
export { ParallaxSection } from './ParallaxSection/ParallaxSection.js';
|
|
13
|
+
export { TiltCard } from './TiltCard/TiltCard.js';
|
|
17
14
|
export { ScrollReveal } from './ScrollReveal/ScrollReveal.js';
|
|
18
|
-
export {
|
|
19
|
-
export { PageTransition } from './PageTransition/PageTransition.js';
|
|
15
|
+
export { Preloader } from './Preloader/Preloader.js';
|
|
20
16
|
export { InteractiveCharacters } from './InteractiveCharacters/InteractiveCharacters.js';
|
|
21
17
|
export { InsetCircleButton } from './Neumorphic/InsetCircleButton.js';
|
|
22
18
|
export { InsetPill } from './Neumorphic/InsetPill.js';
|
|
@@ -36,6 +36,12 @@ const CheckboxComponent = React__default.forwardRef(({ id: idProp, name: namePro
|
|
|
36
36
|
else {
|
|
37
37
|
isChecked = internalChecked;
|
|
38
38
|
}
|
|
39
|
+
// A checked checkbox has been acted upon, so it should no longer read as an
|
|
40
|
+
// error: once checked it clears its own invalid styling (box border + label).
|
|
41
|
+
// The group-level error message stays under the consumer's control — this only
|
|
42
|
+
// resolves the per-item state so unchecked siblings keep signalling the error.
|
|
43
|
+
const showInvalid = isInvalid && !(isChecked && !indeterminate);
|
|
44
|
+
const visualState = isDisabled ? "disabled" : showInvalid ? "invalid" : "default";
|
|
39
45
|
const inputRef = useRef(null);
|
|
40
46
|
// Set indeterminate property on the input element
|
|
41
47
|
useEffect(() => {
|
|
@@ -69,7 +75,7 @@ const CheckboxComponent = React__default.forwardRef(({ id: idProp, name: namePro
|
|
|
69
75
|
ref(node);
|
|
70
76
|
else if (ref)
|
|
71
77
|
ref.current = node;
|
|
72
|
-
}, type: "checkbox", id: id, name: name, value: value, checked: isChecked, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "aria-invalid":
|
|
78
|
+
}, type: "checkbox", id: id, name: name, value: value, checked: isChecked, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "aria-invalid": showInvalid || undefined, "data-state": visualState, className: cn(checkboxTheme.inputStyle, checkboxTheme.sizes[size], indeterminate && "bg-neutral-200") }), jsxs(AnimatePresence, { mode: "wait", children: [indeterminate && (jsx(motion.svg, { viewBox: "0 0 16 16", fill: "none", className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center text-neutral-600", size === "sm" ? "size-3" : size === "lg" ? "size-5" : "size-4"), children: jsx(motion.path, { d: "M3.5 8 L12.5 8", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", variants: shouldReduceMotion ? reducedMotionVariants : indeterminateVariants, initial: "unchecked", animate: "checked", exit: "unchecked" }) }, "indeterminate")), isChecked && !indeterminate && (jsx(motion.svg, { viewBox: "0 0 16 16", fill: "none", className: cn("pointer-events-none col-start-1 row-start-1 self-center justify-self-center text-white", size === "sm" ? "size-3" : size === "lg" ? "size-5" : "size-4"), children: jsx(motion.path, { d: "M3.5 8.5 L6.5 11.5 L12.5 4.5", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", variants: shouldReduceMotion ? reducedMotionVariants : checkmarkVariants, initial: "unchecked", animate: "checked", exit: "unchecked" }) }, "checkmark"))] })] }), (label || description) && (jsxs("label", { htmlFor: id, className: cn("cursor-pointer", isDisabled && "cursor-not-allowed"), children: [label && (typeof label === 'string' ? (jsx("span", { className: cn(formLabelTheme.baseStyle, formLabelTheme.stateStyles[visualState], "mb-0"), children: label })) : (label)), description && (typeof description === 'string' ? (jsx("div", { id: `${id}-description`, className: checkboxTheme.descriptionStyle, children: description })) : (description))] }))] }));
|
|
73
79
|
});
|
|
74
80
|
CheckboxComponent.displayName = "Checkbox";
|
|
75
81
|
const Checkbox = Object.assign(CheckboxComponent, {
|
|
@@ -27,8 +27,8 @@ const datePickerTheme = {
|
|
|
27
27
|
iconEndStyle: formsBaseTheme.iconStyles.right,
|
|
28
28
|
iconEndPadding: formsBaseTheme.iconStyles.padding.right,
|
|
29
29
|
// Dropdown body - floating overlay surface flips automatically
|
|
30
|
-
bodyStyle: "min-w-fit max-w-none bg-[var(--color-surface-overlay)] border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-real-xl p-0 overflow-hidden z-[1000] fixed",
|
|
31
|
-
bodyWithPresetsStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none bg-[var(--color-surface-overlay)] border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
30
|
+
bodyStyle: "min-w-fit max-w-none bg-[var(--color-surface-overlay)]/80 backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-real-xl p-0 overflow-hidden z-[1000] fixed",
|
|
31
|
+
bodyWithPresetsStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none bg-[var(--color-surface-overlay)]/80 backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
32
32
|
// Presets sidebar - recessed sunken panel flips automatically
|
|
33
33
|
presetsContainerStyle: "flex flex-col gap-1 p-3 border-b sm:border-b-0 sm:border-r border-[var(--color-border)] bg-[var(--color-surface-sunken)] sm:min-w-[180px]",
|
|
34
34
|
// Preset button - surface hover/active fills flip automatically
|
|
@@ -19,7 +19,7 @@ const dateRangePickerTheme = {
|
|
|
19
19
|
triggerFocusStates: formsBaseTheme.focusStates,
|
|
20
20
|
iconEndStyle: formsBaseTheme.iconStyles.right,
|
|
21
21
|
iconEndPadding: formsBaseTheme.iconStyles.padding.right,
|
|
22
|
-
bodyStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none bg-[var(--color-surface-overlay)] border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
22
|
+
bodyStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none bg-[var(--color-surface-overlay)]/80 backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
23
23
|
presetsContainerStyle: "hidden sm:flex flex-col gap-1 p-3 sm:border-r border-[var(--color-border)] bg-[var(--color-surface-sunken)] sm:min-w-[180px]",
|
|
24
24
|
presetButtonStyle: "w-full text-left px-3 py-2 text-sm font-medium rounded-[calc(var(--radius-base)*0.75)] transition-colors cursor-pointer " +
|
|
25
25
|
"flex items-center justify-between gap-2 " +
|