@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
|
@@ -25,7 +25,7 @@ import { useSmoothScroll } from './smooth/useSmoothScroll.js';
|
|
|
25
25
|
* </ScrollArea>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
const ScrollArea = React__default.forwardRef(({ children, type = 'hover', size = 'default', orientation = 'vertical', snap, snapAlign = 'start', smooth =
|
|
28
|
+
const ScrollArea = React__default.forwardRef(({ children, type = 'hover', size = 'default', orientation = 'vertical', dragToScroll = false, snap, snapAlign = 'start', smooth = true, smoothConfig, onScrollProgress, onPerformanceUpdate, className, theme, ...props }, ref) => {
|
|
29
29
|
// Internal ref for the scrollable element
|
|
30
30
|
const internalRef = useRef(null);
|
|
31
31
|
// Determine scroll orientation for smooth scroll
|
|
@@ -58,14 +58,244 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', size =
|
|
|
58
58
|
const extendedRef = element;
|
|
59
59
|
// Add smooth scroll methods if smooth is enabled
|
|
60
60
|
if (smooth && smoothAPI) {
|
|
61
|
-
extendedRef.smoothScrollTo =
|
|
61
|
+
extendedRef.smoothScrollTo = (position, options) => {
|
|
62
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
63
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
64
|
+
inertiaFrameIdRef.current = null;
|
|
65
|
+
}
|
|
66
|
+
smoothAPI.scrollTo(position, options);
|
|
67
|
+
};
|
|
62
68
|
extendedRef.getScrollVelocity = smoothAPI.getVelocity;
|
|
63
69
|
extendedRef.pauseSmoothScroll = smoothAPI.stop;
|
|
64
70
|
extendedRef.resumeSmoothScroll = smoothAPI.start;
|
|
65
71
|
extendedRef.refreshSnapPoints = smoothAPI.refreshSnapPoints;
|
|
66
72
|
}
|
|
73
|
+
extendedRef.setPosition = (position) => {
|
|
74
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
75
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
76
|
+
inertiaFrameIdRef.current = null;
|
|
77
|
+
}
|
|
78
|
+
if (smooth && smoothAPI) {
|
|
79
|
+
smoothAPI.setPosition(position);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const max = orientation === 'horizontal'
|
|
83
|
+
? element.scrollWidth - element.clientWidth
|
|
84
|
+
: element.scrollHeight - element.clientHeight;
|
|
85
|
+
const clamped = Math.max(0, Math.min(max, position));
|
|
86
|
+
if (orientation === 'horizontal') {
|
|
87
|
+
element.scrollLeft = clamped;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
element.scrollTop = clamped;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
67
94
|
return extendedRef;
|
|
68
|
-
}, [smooth, smoothAPI]);
|
|
95
|
+
}, [smooth, smoothAPI, orientation]);
|
|
96
|
+
// Drag-to-scroll (mouse panning) with inertia.
|
|
97
|
+
const dragRef = useRef(null);
|
|
98
|
+
const suppressClickRef = useRef(false);
|
|
99
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
100
|
+
const inertiaFrameIdRef = useRef(null);
|
|
101
|
+
// Cancel inertia animation on unmount
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
return () => {
|
|
104
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
105
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}, []);
|
|
109
|
+
const startDragInertia = (vx, vy) => {
|
|
110
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
111
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
112
|
+
}
|
|
113
|
+
let lastTime = performance.now();
|
|
114
|
+
const el = internalRef.current;
|
|
115
|
+
if (!el)
|
|
116
|
+
return;
|
|
117
|
+
const tick = (now) => {
|
|
118
|
+
const dt = now - lastTime;
|
|
119
|
+
lastTime = now;
|
|
120
|
+
// Prevent frame skip issues when tab is backgrounded
|
|
121
|
+
if (dt > 100) {
|
|
122
|
+
inertiaFrameIdRef.current = requestAnimationFrame(tick);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// Apply friction decay (0.95 per 16.67ms frame)
|
|
126
|
+
const friction = 0.95;
|
|
127
|
+
const timeFactor = dt / 16.67;
|
|
128
|
+
const currentFriction = Math.pow(friction, timeFactor);
|
|
129
|
+
let activeVx = vx;
|
|
130
|
+
let activeVy = vy;
|
|
131
|
+
if (orientation === 'vertical') {
|
|
132
|
+
activeVx = 0;
|
|
133
|
+
}
|
|
134
|
+
else if (orientation === 'horizontal') {
|
|
135
|
+
activeVy = 0;
|
|
136
|
+
}
|
|
137
|
+
const deltaX = activeVx * dt;
|
|
138
|
+
const deltaY = activeVy * dt;
|
|
139
|
+
const nextLeft = el.scrollLeft + deltaX;
|
|
140
|
+
const nextTop = el.scrollTop + deltaY;
|
|
141
|
+
// Apply positions
|
|
142
|
+
if (smooth && smoothAPI) {
|
|
143
|
+
if (smoothOrientation === 'horizontal') {
|
|
144
|
+
smoothAPI.setPosition(nextLeft);
|
|
145
|
+
if (orientation === 'both') {
|
|
146
|
+
el.scrollTop = nextTop;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
smoothAPI.setPosition(nextTop);
|
|
151
|
+
if (orientation === 'both') {
|
|
152
|
+
el.scrollLeft = nextLeft;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (orientation !== 'vertical')
|
|
158
|
+
el.scrollLeft = nextLeft;
|
|
159
|
+
if (orientation !== 'horizontal')
|
|
160
|
+
el.scrollTop = nextTop;
|
|
161
|
+
}
|
|
162
|
+
// Decay velocity
|
|
163
|
+
vx *= currentFriction;
|
|
164
|
+
vy *= currentFriction;
|
|
165
|
+
// If we hit scroll boundaries, stop inertia on that axis
|
|
166
|
+
const maxScrollLeft = el.scrollWidth - el.clientWidth;
|
|
167
|
+
const maxScrollTop = el.scrollHeight - el.clientHeight;
|
|
168
|
+
if (el.scrollLeft <= 0 || el.scrollLeft >= maxScrollLeft)
|
|
169
|
+
vx = 0;
|
|
170
|
+
if (el.scrollTop <= 0 || el.scrollTop >= maxScrollTop)
|
|
171
|
+
vy = 0;
|
|
172
|
+
const currentSpeed = Math.sqrt(vx * vx + vy * vy);
|
|
173
|
+
if (currentSpeed > 0.05) {
|
|
174
|
+
inertiaFrameIdRef.current = requestAnimationFrame(tick);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
inertiaFrameIdRef.current = null;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
inertiaFrameIdRef.current = requestAnimationFrame(tick);
|
|
181
|
+
};
|
|
182
|
+
const onDragPointerDown = (e) => {
|
|
183
|
+
if (e.pointerType !== 'mouse' || e.button !== 0)
|
|
184
|
+
return;
|
|
185
|
+
// Stop any running inertia animation on fresh interaction
|
|
186
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
187
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
188
|
+
inertiaFrameIdRef.current = null;
|
|
189
|
+
}
|
|
190
|
+
suppressClickRef.current = false;
|
|
191
|
+
if (e.target.closest('input, textarea, select, [contenteditable="true"]'))
|
|
192
|
+
return;
|
|
193
|
+
const el = internalRef.current;
|
|
194
|
+
if (!el)
|
|
195
|
+
return;
|
|
196
|
+
dragRef.current = {
|
|
197
|
+
startX: e.clientX,
|
|
198
|
+
startY: e.clientY,
|
|
199
|
+
scrollLeft: el.scrollLeft,
|
|
200
|
+
scrollTop: el.scrollTop,
|
|
201
|
+
dragging: false,
|
|
202
|
+
pointerId: e.pointerId,
|
|
203
|
+
history: [{ time: performance.now(), x: e.clientX, y: e.clientY }]
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const onDragPointerMove = (e) => {
|
|
207
|
+
const drag = dragRef.current;
|
|
208
|
+
const el = internalRef.current;
|
|
209
|
+
if (!drag || !el)
|
|
210
|
+
return;
|
|
211
|
+
const now = performance.now();
|
|
212
|
+
drag.history.push({ time: now, x: e.clientX, y: e.clientY });
|
|
213
|
+
// Keep only the last 100ms of history for velocity calculation
|
|
214
|
+
while (drag.history.length > 0 && now - drag.history[0].time > 100) {
|
|
215
|
+
drag.history.shift();
|
|
216
|
+
}
|
|
217
|
+
const dx = e.clientX - drag.startX;
|
|
218
|
+
const dy = e.clientY - drag.startY;
|
|
219
|
+
if (!drag.dragging) {
|
|
220
|
+
if (Math.abs(dx) < 4 && Math.abs(dy) < 4)
|
|
221
|
+
return;
|
|
222
|
+
drag.dragging = true;
|
|
223
|
+
setIsDragging(true);
|
|
224
|
+
el.setPointerCapture(drag.pointerId);
|
|
225
|
+
}
|
|
226
|
+
const targetLeft = drag.scrollLeft - dx;
|
|
227
|
+
const targetTop = drag.scrollTop - dy;
|
|
228
|
+
if (smooth && smoothAPI) {
|
|
229
|
+
if (smoothOrientation === 'horizontal') {
|
|
230
|
+
smoothAPI.setPosition(targetLeft);
|
|
231
|
+
if (orientation === 'both') {
|
|
232
|
+
el.scrollTop = targetTop;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
smoothAPI.setPosition(targetTop);
|
|
237
|
+
if (orientation === 'both') {
|
|
238
|
+
el.scrollLeft = targetLeft;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
if (orientation !== 'vertical')
|
|
244
|
+
el.scrollLeft = targetLeft;
|
|
245
|
+
if (orientation !== 'horizontal')
|
|
246
|
+
el.scrollTop = targetTop;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const onDragPointerEnd = (e) => {
|
|
250
|
+
var _a;
|
|
251
|
+
const drag = dragRef.current;
|
|
252
|
+
if (!drag)
|
|
253
|
+
return;
|
|
254
|
+
if (drag.dragging) {
|
|
255
|
+
suppressClickRef.current = e.type === 'pointerup';
|
|
256
|
+
setIsDragging(false);
|
|
257
|
+
const el = internalRef.current;
|
|
258
|
+
if (el) {
|
|
259
|
+
(_a = el.releasePointerCapture) === null || _a === void 0 ? void 0 : _a.call(el, drag.pointerId);
|
|
260
|
+
// Calculate release velocity
|
|
261
|
+
const now = performance.now();
|
|
262
|
+
const recentHistory = drag.history.filter(h => now - h.time < 100);
|
|
263
|
+
if (recentHistory.length >= 2) {
|
|
264
|
+
const first = recentHistory[0];
|
|
265
|
+
const last = recentHistory[recentHistory.length - 1];
|
|
266
|
+
const dt = last.time - first.time;
|
|
267
|
+
if (dt > 10) {
|
|
268
|
+
const vx = (last.x - first.x) / dt;
|
|
269
|
+
const vy = (last.y - first.y) / dt;
|
|
270
|
+
const speed = Math.sqrt(vx * vx + vy * vy);
|
|
271
|
+
// Only trigger inertia if speed is high enough AND smooth scrolling is enabled
|
|
272
|
+
if (speed > 0.15 && smooth) {
|
|
273
|
+
startDragInertia(-vx, -vy);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
dragRef.current = null;
|
|
280
|
+
};
|
|
281
|
+
const onDragClickCapture = (e) => {
|
|
282
|
+
if (!suppressClickRef.current)
|
|
283
|
+
return;
|
|
284
|
+
suppressClickRef.current = false;
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
e.stopPropagation();
|
|
287
|
+
};
|
|
288
|
+
const dragHandlers = dragToScroll
|
|
289
|
+
? {
|
|
290
|
+
onPointerDown: onDragPointerDown,
|
|
291
|
+
onPointerMove: onDragPointerMove,
|
|
292
|
+
onPointerUp: onDragPointerEnd,
|
|
293
|
+
onPointerCancel: onDragPointerEnd,
|
|
294
|
+
onClickCapture: onDragClickCapture,
|
|
295
|
+
// Native HTML5 drag (images, links) hijacks the gesture mid-pan
|
|
296
|
+
onDragStart: (e) => e.preventDefault(),
|
|
297
|
+
}
|
|
298
|
+
: undefined;
|
|
69
299
|
// Scroll-detection state for type='scroll' (overlay scrollbar)
|
|
70
300
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
71
301
|
const scrollTimerRef = useRef(undefined);
|
|
@@ -181,7 +411,15 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', size =
|
|
|
181
411
|
].join(' ');
|
|
182
412
|
}
|
|
183
413
|
}, [type]);
|
|
184
|
-
|
|
414
|
+
const onWheel = (e) => {
|
|
415
|
+
var _a;
|
|
416
|
+
if (inertiaFrameIdRef.current !== null) {
|
|
417
|
+
cancelAnimationFrame(inertiaFrameIdRef.current);
|
|
418
|
+
inertiaFrameIdRef.current = null;
|
|
419
|
+
}
|
|
420
|
+
(_a = props.onWheel) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
421
|
+
};
|
|
422
|
+
return (jsx("div", { ref: internalRef, className: cn(resolvedTheme.baseStyle, overflowClasses, snapClasses, scrollbarBase, scrollbarVisibility, dragToScroll && 'cursor-grab', isDragging && 'cursor-grabbing select-none', className), "data-orientation": orientation, "data-type": type, "data-smooth": smooth, "data-scrolling": isScrolling || undefined, "data-dragging": isDragging || undefined, ...props, ...dragHandlers, onWheel: onWheel, children: children }));
|
|
185
423
|
});
|
|
186
424
|
ScrollArea.displayName = 'ScrollArea';
|
|
187
425
|
|
|
@@ -43,6 +43,8 @@ export interface ScrollAreaRef extends HTMLDivElement {
|
|
|
43
43
|
pauseSmoothScroll?: () => void;
|
|
44
44
|
/** Resume smooth scrolling */
|
|
45
45
|
resumeSmoothScroll?: () => void;
|
|
46
|
+
/** Set scroll position immediately without animation */
|
|
47
|
+
setPosition?: (position: number) => void;
|
|
46
48
|
/** Refresh snap points */
|
|
47
49
|
refreshSnapPoints?: () => void;
|
|
48
50
|
}
|
|
@@ -89,9 +91,18 @@ export interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
89
91
|
*/
|
|
90
92
|
snapAlign?: 'start' | 'center' | 'end';
|
|
91
93
|
/**
|
|
92
|
-
* Enable
|
|
94
|
+
* Enable mouse drag-to-scroll panning (grab the content and drag, like touch).
|
|
95
|
+
* Mouse-only — touch input already pans natively. A real drag needs ~4px of
|
|
96
|
+
* movement first, so plain clicks on content (cards, buttons) still work; the
|
|
97
|
+
* click that would follow a completed drag is suppressed. Drags never start
|
|
98
|
+
* from text fields, so selection inside inputs/textareas is unaffected.
|
|
93
99
|
* @default false
|
|
94
100
|
*/
|
|
101
|
+
dragToScroll?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Enable smooth momentum-based scrolling
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
95
106
|
smooth?: boolean;
|
|
96
107
|
/**
|
|
97
108
|
* Configuration for smooth scrolling
|
|
@@ -98,6 +98,10 @@ export declare class SmoothScrollEngine {
|
|
|
98
98
|
* Scroll to element
|
|
99
99
|
*/
|
|
100
100
|
scrollToElement(element: HTMLElement, options?: ScrollToOptions): void;
|
|
101
|
+
/**
|
|
102
|
+
* Set scroll position immediately without animation, updating internal state
|
|
103
|
+
*/
|
|
104
|
+
setPosition(position: number): void;
|
|
101
105
|
/**
|
|
102
106
|
* Get current velocity
|
|
103
107
|
*/
|
|
@@ -447,6 +447,29 @@ class SmoothScrollEngine {
|
|
|
447
447
|
}
|
|
448
448
|
this.scrollTo(position, options);
|
|
449
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Set scroll position immediately without animation, updating internal state
|
|
452
|
+
*/
|
|
453
|
+
setPosition(position) {
|
|
454
|
+
const max = getMaxScroll(this.element, this.orientation);
|
|
455
|
+
const clamped = clampScroll(position, 0, max);
|
|
456
|
+
this.state.current = clamped;
|
|
457
|
+
this.state.target = clamped;
|
|
458
|
+
this.previousPosition = clamped;
|
|
459
|
+
this.state.velocity.current = 0;
|
|
460
|
+
this.state.velocity.previous = 0;
|
|
461
|
+
// Sync to DOM
|
|
462
|
+
if (this.orientation === 'horizontal') {
|
|
463
|
+
this.element.scrollLeft = clamped;
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.element.scrollTop = clamped;
|
|
467
|
+
}
|
|
468
|
+
// Stop any ongoing programmatic scroll or snapping
|
|
469
|
+
this.state.isSnapping = false;
|
|
470
|
+
this.state.targetSnapPoint = null;
|
|
471
|
+
this.animationOnComplete = null;
|
|
472
|
+
}
|
|
450
473
|
/**
|
|
451
474
|
* Get current velocity
|
|
452
475
|
*/
|
|
@@ -106,6 +106,10 @@ function useSmoothScroll(elementRef, config = {}, orientation = 'vertical') {
|
|
|
106
106
|
var _a;
|
|
107
107
|
(_a = engineRef.current) === null || _a === void 0 ? void 0 : _a.updateConfig(newConfig);
|
|
108
108
|
},
|
|
109
|
+
setPosition: (position) => {
|
|
110
|
+
var _a;
|
|
111
|
+
(_a = engineRef.current) === null || _a === void 0 ? void 0 : _a.setPosition(position);
|
|
112
|
+
},
|
|
109
113
|
refreshSnapPoints: () => {
|
|
110
114
|
var _a;
|
|
111
115
|
(_a = engineRef.current) === null || _a === void 0 ? void 0 : _a.refreshSnapPoints();
|
|
@@ -39,6 +39,11 @@ export interface SmoothScrollAPI {
|
|
|
39
39
|
* @param config - Partial configuration to update
|
|
40
40
|
*/
|
|
41
41
|
update: (config: SmoothScrollConfigUpdate) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Set scroll position immediately without animation, updating internal state
|
|
44
|
+
* @param position - Target scroll position in pixels
|
|
45
|
+
*/
|
|
46
|
+
setPosition: (position: number) => void;
|
|
42
47
|
/**
|
|
43
48
|
* Refresh snap points (call when DOM changes)
|
|
44
49
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const segmentedTheme = {
|
|
5
5
|
// Base styles for the segmented container
|
|
6
|
-
baseStyle: "relative flex rounded-[var(--segmented-radius)] bg-
|
|
6
|
+
baseStyle: "relative flex rounded-[var(--segmented-radius)] bg-neutral-100 dark:bg-neutral-900 border border-[var(--color-border)] p-[var(--segmented-padding)] shadow-inner-real-md",
|
|
7
7
|
// Size variants using CSS variables
|
|
8
8
|
sizes: {
|
|
9
9
|
sm: "min-h-[var(--segmented-min-h-sm)]",
|
|
@@ -15,7 +15,7 @@ const segmentedTheme = {
|
|
|
15
15
|
// Disabled style
|
|
16
16
|
disabledStyle: "opacity-50 cursor-not-allowed pointer-events-none",
|
|
17
17
|
// Sliding background style with CSS variables
|
|
18
|
-
slidingBackgroundStyle: "absolute top-[0px] left-[0px] rounded-[var(--segmented-inner-radius)] transition-transform duration-200 ease-out pointer-events-none z-0 bg-
|
|
18
|
+
slidingBackgroundStyle: "absolute top-[0px] left-[0px] rounded-[var(--segmented-inner-radius)] transition-transform duration-200 ease-out pointer-events-none z-0 bg-[var(--color-surface)] shadow-real-md dark:bg-neutral-800",
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Default theme for the SegmentedItem component
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const tooltipTheme = {
|
|
2
2
|
// Base style for the tooltip - using fixed positioning for portal rendering
|
|
3
|
-
baseStyle: "fixed z-[99] rounded-[var(--tooltip-radius)] py-1 px-2 text-xs text-[var(--color-text-primary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 pointer-events-none bg-[var(--color-surface-overlay)]/
|
|
3
|
+
baseStyle: "fixed z-[99] rounded-[var(--tooltip-radius)] py-1 px-2 text-xs text-[var(--color-text-primary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 pointer-events-none bg-[var(--color-surface-overlay)]/80 backdrop-blur-lg outline outline-[var(--color-border)] shadow-lg",
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
export { tooltipTheme };
|
|
@@ -17,6 +17,8 @@ export { calendarAnimations } from './Calendar/Calendar.animations.js';
|
|
|
17
17
|
export { CalendarMini } from './Calendar/CalendarMini/CalendarMini.js';
|
|
18
18
|
export { Card } from './Card/Card.js';
|
|
19
19
|
export { CardStack } from './CardStack/CardStack.js';
|
|
20
|
+
export { HERO_CARD_DEFAULT_IMAGE, HeroCard } from './HeroCard/HeroCard.js';
|
|
21
|
+
export { heroCardTheme } from './HeroCard/HeroCard.theme.js';
|
|
20
22
|
export { Carousel } from './Carousel/Carousel.js';
|
|
21
23
|
export { CarouselBody } from './Carousel/CarouselBody.js';
|
|
22
24
|
export { CommandPalette } from './CommandPalette/CommandPalette.js';
|
|
@@ -17,19 +17,35 @@ function useDescriptionListContext() {
|
|
|
17
17
|
// ──────────────────────────────────────────────
|
|
18
18
|
// DescriptionList (container)
|
|
19
19
|
// ──────────────────────────────────────────────
|
|
20
|
-
const DescriptionListRoot = React__default.forwardRef(({ className, variant = "horizontal", theme: customTheme, children, ...props }, ref) => {
|
|
21
|
-
const theme = useMemo(() => ({
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const DescriptionListRoot = React__default.forwardRef(({ className, variant = "horizontal", padding = "flush", items, theme: customTheme, children, ...props }, ref) => {
|
|
21
|
+
const theme = useMemo(() => ({
|
|
22
|
+
...descriptionListTheme,
|
|
23
|
+
...customTheme,
|
|
24
|
+
paddingStyles: { ...descriptionListTheme.paddingStyles, ...customTheme === null || customTheme === void 0 ? void 0 : customTheme.paddingStyles },
|
|
25
|
+
}), [customTheme]);
|
|
26
|
+
const contextValue = useMemo(() => ({ variant, padding, theme }), [variant, padding, theme]);
|
|
27
|
+
if (process.env.NODE_ENV !== "production" &&
|
|
28
|
+
items &&
|
|
29
|
+
React__default.Children.count(children) > 0) {
|
|
30
|
+
console.warn("[DescriptionList]: both `items` and children were provided — `items` takes precedence and children are ignored.");
|
|
31
|
+
}
|
|
32
|
+
// Data-driven path maps to the same compound primitive as composition.
|
|
33
|
+
const content = items
|
|
34
|
+
? items.map((item, i) => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (jsx(DescriptionListItem, { label: item.label, value: item.value, className: item.className }, (_a = item.key) !== null && _a !== void 0 ? _a : i));
|
|
37
|
+
})
|
|
38
|
+
: children;
|
|
39
|
+
return (jsx(DescriptionListContext.Provider, { value: contextValue, children: jsx("dl", { ref: ref, className: cn(theme.baseStyle, className), ...props, children: content }) }));
|
|
24
40
|
});
|
|
25
41
|
DescriptionListRoot.displayName = "DescriptionList";
|
|
26
42
|
// ──────────────────────────────────────────────
|
|
27
43
|
// DescriptionList.Item
|
|
28
44
|
// ──────────────────────────────────────────────
|
|
29
|
-
const DescriptionListItem = React__default.forwardRef(({
|
|
30
|
-
const { variant, theme } = useDescriptionListContext();
|
|
45
|
+
const DescriptionListItem = React__default.forwardRef(({ label, value, className, ...props }, ref) => {
|
|
46
|
+
const { variant, padding, theme } = useDescriptionListContext();
|
|
31
47
|
const isHorizontal = variant === "horizontal";
|
|
32
|
-
return (jsxs("div", { ref: ref, className: cn(theme.itemStyle, isHorizontal && "sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0", className), ...props, children: [jsx("dt", { className: theme.
|
|
48
|
+
return (jsxs("div", { ref: ref, className: cn(theme.itemStyle, isHorizontal && "sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0", theme.paddingStyles[padding], className), ...props, children: [jsx("dt", { className: theme.labelStyle, children: label }), jsx("dd", { className: cn(theme.valueStyle, isHorizontal && "sm:col-span-2 sm:mt-0"), children: value })] }));
|
|
33
49
|
});
|
|
34
50
|
DescriptionListItem.displayName = "DescriptionList.Item";
|
|
35
51
|
// ──────────────────────────────────────────────
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
const descriptionListTheme = {
|
|
2
2
|
baseStyle: "divide-y divide-[var(--color-border)] min-w-0",
|
|
3
|
-
itemStyle: "
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
itemStyle: "py-2.5",
|
|
4
|
+
// Edge-padding modes (mirrors Table's `flush`): `flush` (default) zeroes the item
|
|
5
|
+
// side padding so values sit flush with the container edges (e.g. inside a Card);
|
|
6
|
+
// `default` adds horizontal padding for standalone use.
|
|
7
|
+
paddingStyles: {
|
|
8
|
+
default: "px-4",
|
|
9
|
+
flush: "px-0",
|
|
10
|
+
},
|
|
11
|
+
labelStyle: "text-sm font-medium text-[var(--color-text-primary)]",
|
|
12
|
+
valueStyle: "text-sm mt-0.5 text-[var(--color-text-secondary)]",
|
|
6
13
|
};
|
|
7
14
|
|
|
8
15
|
export { descriptionListTheme };
|
|
@@ -1,34 +1,73 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type DescriptionListVariant = "horizontal" | "vertical";
|
|
3
|
+
/**
|
|
4
|
+
* Edge padding behavior for list items (mirrors Table's `padding`).
|
|
5
|
+
* - `default`: items get horizontal side padding.
|
|
6
|
+
* - `flush`: items have zero side padding so labels/values align flush with the
|
|
7
|
+
* container edges (e.g. inside a padded Card).
|
|
8
|
+
*/
|
|
9
|
+
export type DescriptionListPadding = "default" | "flush";
|
|
3
10
|
export interface DescriptionListTheme {
|
|
4
11
|
/** Base styles for the <dl> container */
|
|
5
12
|
baseStyle: string;
|
|
6
13
|
/** Styles for each item wrapper */
|
|
7
14
|
itemStyle: string;
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/** Styles for the
|
|
11
|
-
|
|
15
|
+
/** Edge-padding mode classes applied to each item */
|
|
16
|
+
paddingStyles: Record<DescriptionListPadding, string>;
|
|
17
|
+
/** Styles for the label (<dt>) */
|
|
18
|
+
labelStyle: string;
|
|
19
|
+
/** Styles for the value (<dd>) */
|
|
20
|
+
valueStyle: string;
|
|
12
21
|
}
|
|
13
22
|
export interface DescriptionListThemeOverrides {
|
|
14
23
|
baseStyle?: string;
|
|
15
24
|
itemStyle?: string;
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
paddingStyles?: Partial<Record<DescriptionListPadding, string>>;
|
|
26
|
+
labelStyle?: string;
|
|
27
|
+
valueStyle?: string;
|
|
18
28
|
}
|
|
19
29
|
export interface DescriptionListContextValue {
|
|
20
30
|
variant: DescriptionListVariant;
|
|
31
|
+
padding: DescriptionListPadding;
|
|
21
32
|
theme: DescriptionListTheme;
|
|
22
33
|
}
|
|
23
34
|
export interface DescriptionListProps extends React.HTMLAttributes<HTMLDListElement> {
|
|
24
35
|
/** Layout variant: "horizontal" (default) or "vertical" */
|
|
25
36
|
variant?: DescriptionListVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Edge padding behavior. `flush` (default) removes the item side padding so
|
|
39
|
+
* labels/values align flush with the container edges (e.g. inside a padded
|
|
40
|
+
* Card); `default` adds horizontal padding for standalone use.
|
|
41
|
+
*/
|
|
42
|
+
padding?: DescriptionListPadding;
|
|
43
|
+
/**
|
|
44
|
+
* Data-driven items. When provided, the list renders from this array and any
|
|
45
|
+
* `children` are ignored (dev-warns). Omit it to use the compound API.
|
|
46
|
+
* Fully serializable — ideal for generative UI.
|
|
47
|
+
*/
|
|
48
|
+
items?: DescriptionListItemData[];
|
|
26
49
|
/** Custom theme overrides */
|
|
27
50
|
theme?: DescriptionListThemeOverrides;
|
|
51
|
+
/** `DescriptionList.Item` children (compound API). Optional when `items` is used. */
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A single key/value entry for the data-driven (`items`) API. Maps internally
|
|
56
|
+
* to `DescriptionList.Item`.
|
|
57
|
+
*/
|
|
58
|
+
export interface DescriptionListItemData {
|
|
59
|
+
/** The label (rendered as the <dt> term) */
|
|
60
|
+
label: React.ReactNode;
|
|
61
|
+
/** The value (rendered as the <dd> description) */
|
|
62
|
+
value: React.ReactNode;
|
|
63
|
+
/** Optional className forwarded to the item wrapper */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Stable React key (falls back to the array index) */
|
|
66
|
+
key?: string | number;
|
|
28
67
|
}
|
|
29
68
|
export interface DescriptionListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
30
|
-
/** The
|
|
31
|
-
|
|
32
|
-
/** The
|
|
33
|
-
|
|
69
|
+
/** The label (rendered as the <dt> term) */
|
|
70
|
+
label: React.ReactNode;
|
|
71
|
+
/** The value (rendered as the <dd> description) */
|
|
72
|
+
value: React.ReactNode;
|
|
34
73
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DescriptionList } from "./DescriptionList";
|
|
2
|
-
export type { DescriptionListVariant, DescriptionListProps, DescriptionListItemProps, DescriptionListThemeOverrides, } from "./DescriptionList.types";
|
|
2
|
+
export type { DescriptionListVariant, DescriptionListPadding, DescriptionListProps, DescriptionListItemProps, DescriptionListItemData, DescriptionListThemeOverrides, } from "./DescriptionList.types";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React__default, { createContext, useMemo, useState, useCallback, useContext } from 'react';
|
|
3
3
|
import { useReducedMotion, motion } from 'motion/react';
|
|
4
4
|
import { ChevronUpDownIcon } from '@heroicons/react/16/solid';
|
|
@@ -19,10 +19,33 @@ const useFeedContext = () => {
|
|
|
19
19
|
// ---------------------------------------------------------------------------
|
|
20
20
|
// Feed (root)
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
22
|
-
|
|
22
|
+
/** Render one data-driven item to the compound `Feed.Item` primitive. */
|
|
23
|
+
const renderItemData = (item, index) => {
|
|
24
|
+
var _a;
|
|
25
|
+
return (jsx(FeedItem, { icon: item.icon, timestamp: item.timestamp, indicatorClassName: item.indicatorClassName, className: item.className, children: item.content }, (_a = item.key) !== null && _a !== void 0 ? _a : index));
|
|
26
|
+
};
|
|
27
|
+
const FeedRoot = React__default.forwardRef(({ children, items, collapseAfter, className, theme: themeOverrides, ...props }, ref) => {
|
|
23
28
|
const theme = useMemo(() => ({ ...feedTheme, ...themeOverrides }), [themeOverrides]);
|
|
24
29
|
const contextValue = useMemo(() => ({ theme }), [theme]);
|
|
25
|
-
|
|
30
|
+
if (process.env.NODE_ENV !== "production" &&
|
|
31
|
+
items &&
|
|
32
|
+
React__default.Children.count(children) > 0) {
|
|
33
|
+
console.warn("[Feed]: both `items` and children were provided — `items` takes precedence and children are ignored.");
|
|
34
|
+
}
|
|
35
|
+
// Data-driven path maps to the same compound primitives as composition.
|
|
36
|
+
// With `collapseAfter`, overflow items are tucked into a Feed.Collapse.
|
|
37
|
+
let content = children;
|
|
38
|
+
if (items) {
|
|
39
|
+
if (collapseAfter != null && items.length > collapseAfter) {
|
|
40
|
+
const visible = items.slice(0, collapseAfter);
|
|
41
|
+
const hidden = items.slice(collapseAfter);
|
|
42
|
+
content = (jsxs(Fragment, { children: [visible.map(renderItemData), jsx(FeedCollapse, { children: hidden.map(renderItemData) })] }));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
content = items.map(renderItemData);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return (jsx(FeedContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, className: cn(theme.baseStyle, className), ...props, children: jsx("ul", { role: "list", className: theme.listStyle, children: content }) }) }));
|
|
26
49
|
});
|
|
27
50
|
FeedRoot.displayName = "Feed";
|
|
28
51
|
// ---------------------------------------------------------------------------
|
|
@@ -87,7 +110,7 @@ const FeedCollapse = ({ label = "Show {count} more", icon, defaultExpanded = fal
|
|
|
87
110
|
if (shouldReduceMotion) {
|
|
88
111
|
return (jsxs("li", { className: cn(theme.collapseStyle, className), children: [expanded && (jsx("span", { "aria-hidden": "true", className: "absolute left-5 -translate-x-1/2 top-0 h-full w-0.5 bg-[var(--color-border)]/60" })), !expanded ? (jsxs("div", { className: "relative", style: { height: COLLAPSED_HEIGHT }, children: [jsx("svg", { "aria-hidden": "true", className: theme.collapseSvgStyle, style: { left: "calc(1.25rem - 1px)" }, width: SVG_WIDTH, height: COLLAPSED_HEIGHT, fill: "none", children: jsx("path", { d: CURVE_PATH, stroke: "var(--color-border)", strokeOpacity: "0.6", strokeWidth: STROKE_WIDTH }) }), jsxs("button", { type: "button", className: "absolute top-1/2 -translate-y-1/2 flex items-center gap-2.5 cursor-pointer bg-transparent border-none p-0", style: {
|
|
89
112
|
left: `calc(1.25rem - 1px + ${CURVE_APEX_X + 12}px)`,
|
|
90
|
-
}, onClick: handleToggle, "aria-expanded": false, children: [jsx("div", { className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-surface)] ", children: collapseIcon }), jsx("span", { className: theme.collapseButtonStyle, children: resolvedLabel })] })] })) : (jsxs("div", { children: [clonedChildren, jsx("div", { className: "relative pb-8", children: jsxs("div", { className: theme.itemContentStyle, children: [jsx("div", { className: "flex size-8 ml-1 shrink-0 items-center justify-center rounded-full bg-[var(--color-
|
|
113
|
+
}, onClick: handleToggle, "aria-expanded": false, children: [jsx("div", { className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-surface)] ", children: collapseIcon }), jsx("span", { className: theme.collapseButtonStyle, children: resolvedLabel })] })] })) : (jsxs("div", { children: [clonedChildren, jsx("div", { className: "relative pb-8", children: jsxs("div", { className: theme.itemContentStyle, children: [jsx("div", { className: "flex size-8 ml-1 shrink-0 items-center justify-center rounded-full bg-[var(--color-surface)] ring-2 ring-[var(--color-background)]/50", children: collapseIcon }), jsx("div", { className: theme.contentStyle, children: jsx("button", { type: "button", className: theme.collapseButtonStyle, onClick: handleToggle, "aria-expanded": true, children: "Show less" }) })] }) })] }))] }));
|
|
91
114
|
}
|
|
92
115
|
/* ---- Full multi-stage animation ---- */
|
|
93
116
|
return (jsxs("li", { className: cn(theme.collapseStyle, className), children: [jsx(motion.span, { "aria-hidden": "true", className: "absolute left-5 -translate-x-1/2 top-0 h-full w-0.5 bg-[var(--color-border)]/60", animate: { opacity: expanded ? 1 : 0 }, transition: { duration: 0.2 } }), jsx(motion.div, { animate: {
|
|
@@ -109,7 +132,7 @@ const FeedCollapse = ({ label = "Show {count} more", icon, defaultExpanded = fal
|
|
|
109
132
|
}, transition: {
|
|
110
133
|
duration: 0.25,
|
|
111
134
|
delay: expanded ? STAGGER_BASE_DELAY + count * STAGGER_IN : 0,
|
|
112
|
-
}, children: jsx("div", { className: "relative pb-8", children: jsxs("div", { className: theme.itemContentStyle, children: [jsx("div", { className: "flex size-8 ml-1 shrink-0 items-center justify-center rounded-full bg-[var(--color-
|
|
135
|
+
}, children: jsx("div", { className: "relative pb-8", children: jsxs("div", { className: theme.itemContentStyle, children: [jsx("div", { className: "flex size-8 ml-1 shrink-0 items-center justify-center rounded-full bg-[var(--color-surface)] ring-2 ring-[var(--color-background)]/50", children: collapseIcon }), jsx("div", { className: theme.contentStyle, children: jsx("button", { type: "button", className: theme.collapseButtonStyle, onClick: handleToggle, "aria-expanded": true, children: "Show less" }) })] }) }) })] })] }));
|
|
113
136
|
};
|
|
114
137
|
FeedCollapse.displayName = "Feed.Collapse";
|
|
115
138
|
// ---------------------------------------------------------------------------
|
|
@@ -6,7 +6,7 @@ const feedTheme = {
|
|
|
6
6
|
itemContentStyle: "relative flex items-start space-x-4",
|
|
7
7
|
connectorStyle: "feed-connector absolute top-5 left-5 -translate-x-1/2 h-full w-0.5 bg-[var(--color-border)]",
|
|
8
8
|
// Indicators
|
|
9
|
-
indicatorStyle: "relative flex size-8 ml-1 shrink-0 items-center justify-center bg-[var(--color-
|
|
9
|
+
indicatorStyle: "relative flex size-8 ml-1 shrink-0 items-center justify-center bg-[var(--color-surface)] rounded-full ring-2 ring-[var(--color-background)]/50",
|
|
10
10
|
dotIndicatorStyle: "relative flex size-10 items-center justify-center",
|
|
11
11
|
// Content
|
|
12
12
|
contentStyle: "min-w-0 flex-1 pt-1",
|