@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
|
@@ -28,10 +28,41 @@ export interface FeedThemeOverrides {
|
|
|
28
28
|
collapseSvgStyle?: string;
|
|
29
29
|
}
|
|
30
30
|
export interface FeedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
31
|
-
children
|
|
31
|
+
/** `Feed.Item` / `Feed.Collapse` children (compound API). Optional when `items` is used. */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Data-driven items. When provided, the feed renders from this array and any
|
|
35
|
+
* `children` are ignored (dev-warns). Omit it to use the compound API.
|
|
36
|
+
* Fully serializable (resolve icon NAMES upstream) — ideal for generative UI.
|
|
37
|
+
*/
|
|
38
|
+
items?: FeedItemData[];
|
|
39
|
+
/**
|
|
40
|
+
* When set with `items`, items beyond this count are wrapped in a
|
|
41
|
+
* `Feed.Collapse` (shown behind a "Show N more" toggle). Ignored for the
|
|
42
|
+
* compound API.
|
|
43
|
+
*/
|
|
44
|
+
collapseAfter?: number;
|
|
32
45
|
theme?: FeedThemeOverrides;
|
|
33
46
|
className?: string;
|
|
34
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* A single feed entry for the data-driven (`items`) API. Maps internally to
|
|
50
|
+
* `Feed.Item`.
|
|
51
|
+
*/
|
|
52
|
+
export interface FeedItemData {
|
|
53
|
+
/** Icon or avatar element rendered as the indicator */
|
|
54
|
+
icon?: ReactNode;
|
|
55
|
+
/** Timestamp label (e.g. "6d ago") */
|
|
56
|
+
timestamp?: ReactNode;
|
|
57
|
+
/** Body content (maps to the Feed.Item children) */
|
|
58
|
+
content?: ReactNode;
|
|
59
|
+
/** Custom className for the indicator wrapper (icon background circle) */
|
|
60
|
+
indicatorClassName?: string;
|
|
61
|
+
/** Optional className forwarded to the item wrapper */
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Stable React key (falls back to the array index) */
|
|
64
|
+
key?: string | number;
|
|
65
|
+
}
|
|
35
66
|
/** @internal Injected by Feed.Collapse via cloneElement */
|
|
36
67
|
export interface FeedItemInternalProps {
|
|
37
68
|
_as?: "li" | "div";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Feed } from "./Feed";
|
|
2
|
-
export type { FeedProps, FeedItemProps, FeedCollapseProps, FeedItemInternalProps, FeedTheme, FeedThemeOverrides, } from "./Feed.types";
|
|
2
|
+
export type { FeedProps, FeedItemProps, FeedItemData, FeedCollapseProps, FeedItemInternalProps, FeedTheme, FeedThemeOverrides, } from "./Feed.types";
|
|
@@ -2,18 +2,18 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { metricTheme } from './Metric.theme.js';
|
|
5
|
+
import { Badge } from '../../core/Badge/Badge.js';
|
|
6
|
+
import { Card } from '../../core/Card/Card.js';
|
|
5
7
|
import { ArrowTrendingUpIcon, ArrowTrendingDownIcon } from '@heroicons/react/24/outline';
|
|
6
8
|
|
|
7
9
|
const Metric = React__default.forwardRef(({ value, label, subtitle, trendValue, trendDirection = "up", trendChart, size = "md", variant = "filled", color = "primary", icon, className, ...props }, ref) => {
|
|
8
|
-
|
|
9
|
-
const trendIcon = trendDirection === "up" ? (jsx(ArrowTrendingUpIcon, { className: "size-3.5", strokeWidth: 2.5 })) : (jsx(ArrowTrendingDownIcon, { className: "size-3.5", strokeWidth: 2.5 }));
|
|
10
|
-
const sizeStyles = metricTheme.sizes[size];
|
|
10
|
+
const trendIcon = trendDirection === "up" ? (jsx(ArrowTrendingUpIcon, { className: "size-3", strokeWidth: 2 })) : (jsx(ArrowTrendingDownIcon, { className: "size-3", strokeWidth: 2 }));
|
|
11
11
|
const variantStyles = metricTheme.variants[variant];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
// Ghost has no surface, so it renders flush (no inset) to align with
|
|
13
|
+
// surrounding content; filled/glass keep their size-based content padding.
|
|
14
|
+
const contentPadding = variant === "ghost" ? "p-0" : metricTheme.contentPaddingSizes[size];
|
|
15
|
+
const iconStyles = cn(metricTheme.iconColors[color], variant === "glass" && metricTheme.iconGlassShadows[color]);
|
|
16
|
+
return (jsx(Card, { ref: ref, className: cn(metricTheme.baseStyle, variantStyles, className), "data-size": size, ...props, children: jsxs("div", { className: "flex flex-col gap-3 ", children: [jsxs("div", { className: cn("flex items-start gap-3", contentPadding), children: [icon && (jsx("div", { className: cn(metricTheme.iconContainerStyle, metricTheme.iconContainerVariants[variant], iconStyles, metricTheme.iconContainerSizes[size]), children: icon })), jsxs("div", { className: "flex flex-col flex-1", children: [typeof label === 'string' ? (jsx("div", { className: cn(metricTheme.labelStyle, metricTheme.labelSizes[size], icon && cn("mb-0 flex items-center", metricTheme.labelIconAlignSizes[size])), children: label })) : label, jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: cn(metricTheme.valueStyle, metricTheme.valueSizes[size]), children: value }), trendValue && (typeof trendValue === 'string' ? (jsx(Badge, { color: trendDirection === "up" ? "success" : "danger", variant: "soft", size: size === "lg" ? "md" : "sm", iconStart: trendIcon, pill: true, children: trendValue })) : trendValue)] }), subtitle && (typeof subtitle === 'string' ? (jsx("div", { className: cn(metricTheme.subtitleStyle, metricTheme.subtitleSizes[size]), children: subtitle })) : subtitle)] })] }), trendChart && (jsx("div", { className: "w-full h-12 flex-shrink-0 -mt-4", children: trendChart }))] }) }));
|
|
17
17
|
});
|
|
18
18
|
Metric.displayName = "Metric";
|
|
19
19
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MetricTheme } from "./Metric.types";
|
|
2
2
|
/**
|
|
3
|
-
* Default theme for the Metric component
|
|
4
|
-
*
|
|
3
|
+
* Default theme for the Metric component.
|
|
4
|
+
* Flat, sub-component-organized structure (Tabs gold standard): one
|
|
5
|
+
* Record<Size, string> per sub-element, CSS variables for all theming.
|
|
5
6
|
*/
|
|
6
7
|
export declare const metricTheme: MetricTheme;
|
|
@@ -1,82 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default theme for the Metric component
|
|
3
|
-
*
|
|
2
|
+
* Default theme for the Metric component.
|
|
3
|
+
* Flat, sub-component-organized structure (Tabs gold standard): one
|
|
4
|
+
* Record<Size, string> per sub-element, CSS variables for all theming.
|
|
4
5
|
*/
|
|
5
6
|
const metricTheme = {
|
|
6
|
-
// Base container
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// Base container (shared across all variants). Radius + overflow + resting
|
|
8
|
+
// surface come from the Card shell Metric renders into (see Metric.tsx).
|
|
9
|
+
baseStyle: "transition-colors duration-200",
|
|
10
|
+
// Visual style variants — container surface + structure.
|
|
11
|
+
// `filled` adds nothing: it inherits the Card shell's --color-surface-raised.
|
|
12
|
+
// `ghost`/`glass` clear that fill (`!` beats Card's bg utility regardless of
|
|
13
|
+
// source order) so they sit transparent / let the glass gradient read.
|
|
9
14
|
variants: {
|
|
15
|
+
filled: "",
|
|
16
|
+
ghost: "!bg-transparent overflow-visible",
|
|
17
|
+
glass: "glass-effect !bg-transparent",
|
|
18
|
+
},
|
|
19
|
+
// Icon chip base per variant — classes shared across all colors of that variant
|
|
20
|
+
iconContainerVariants: {
|
|
10
21
|
filled: "border border-[var(--color-border)]",
|
|
11
|
-
|
|
22
|
+
ghost: "border border-[var(--color-border)] bg-[var(--color-surface-raised)]/50 shadow-real-lg",
|
|
23
|
+
glass: "glass-effect-2 !ring-0",
|
|
12
24
|
},
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
// Icon tint per semantic color — shared by every variant (the one thing color drives)
|
|
26
|
+
iconColors: {
|
|
27
|
+
neutral: "text-[var(--color-text-primary)]",
|
|
28
|
+
primary: "text-[var(--color-primary)] dark:text-[var(--color-primary-400)]",
|
|
29
|
+
secondary: "text-[var(--color-secondary)] dark:text-[var(--color-secondary-400)]",
|
|
30
|
+
success: "text-[var(--color-success)] dark:text-[var(--color-success-400)]",
|
|
31
|
+
warning: "text-[var(--color-warning)] dark:text-[var(--color-warning-400)]",
|
|
32
|
+
danger: "text-[var(--color-danger)] dark:text-[var(--color-danger-400)]",
|
|
17
33
|
},
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"dark:bg-[var(--color-background-secondary)]",
|
|
27
|
-
success: "bg-white text-[var(--color-success)] border border-[var(--color-border)] " +
|
|
28
|
-
"dark:bg-[var(--color-background-secondary)]",
|
|
29
|
-
warning: "bg-white text-[var(--color-warning)] border border-[var(--color-border)] " +
|
|
30
|
-
"dark:bg-[var(--color-background-secondary)]",
|
|
31
|
-
danger: "bg-white text-[var(--color-danger)] border border-[var(--color-border)] " +
|
|
32
|
-
"dark:bg-[var(--color-background-secondary)]",
|
|
33
|
-
},
|
|
34
|
-
glass: {
|
|
35
|
-
neutral: "glass-effect-1 !ring-0 text-[var(--color-text-primary)]",
|
|
36
|
-
primary: "glass-effect-2 !ring-0 shadow-lg shadow-blue-500/10 text-[var(--color-primary)] " +
|
|
37
|
-
"dark:text-[var(--color-primary-400)]",
|
|
38
|
-
secondary: "glass-effect-2 !ring-0 shadow-lg shadow-gray-500/10 text-[var(--color-secondary)] " +
|
|
39
|
-
"dark:text-[var(--color-secondary-400)]",
|
|
40
|
-
success: "glass-effect-2 !ring-0 shadow-lg shadow-green-500/10 text-[var(--color-success)] " +
|
|
41
|
-
"dark:text-[var(--color-success-400)]",
|
|
42
|
-
warning: "glass-effect-2 !ring-0 shadow-lg shadow-yellow-500/10 text-[var(--color-warning)] " +
|
|
43
|
-
"dark:text-[var(--color-warning-400)]",
|
|
44
|
-
danger: "glass-effect-2 !ring-0 shadow-lg shadow-rose-500/10 text-[var(--color-danger)] " +
|
|
45
|
-
"dark:text-[var(--color-danger-400)]",
|
|
46
|
-
},
|
|
34
|
+
// Glass-only colored glow per semantic color (neutral stays shadowless)
|
|
35
|
+
iconGlassShadows: {
|
|
36
|
+
neutral: "",
|
|
37
|
+
primary: "shadow-lg shadow-blue-500/10",
|
|
38
|
+
secondary: "shadow-lg shadow-gray-500/10",
|
|
39
|
+
success: "shadow-lg shadow-green-500/10",
|
|
40
|
+
warning: "shadow-lg shadow-yellow-500/10",
|
|
41
|
+
danger: "shadow-lg shadow-rose-500/10",
|
|
47
42
|
},
|
|
48
|
-
// Size variants
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
container: "", // Padding moved to content section
|
|
60
|
-
contentPadding: "p-4",
|
|
61
|
-
iconContainer: "size-14",
|
|
62
|
-
label: "text-sm",
|
|
63
|
-
value: "text-2xl",
|
|
64
|
-
subtitle: "text-xs mt-0.5",
|
|
65
|
-
},
|
|
66
|
-
lg: {
|
|
67
|
-
container: "", // Padding moved to content section
|
|
68
|
-
contentPadding: "p-5",
|
|
69
|
-
iconContainer: "size-16",
|
|
70
|
-
label: "text-base",
|
|
71
|
-
value: "text-3xl",
|
|
72
|
-
subtitle: "text-sm mt-1",
|
|
73
|
-
},
|
|
43
|
+
// Size variants — one Record<Size, string> per sub-element
|
|
44
|
+
contentPaddingSizes: { sm: "p-3", md: "p-4", lg: "p-5" },
|
|
45
|
+
iconContainerSizes: { sm: "size-8", md: "size-10", lg: "size-12" },
|
|
46
|
+
// Heights mirror iconContainerSizes — with an icon, the label box spans the
|
|
47
|
+
// chip's height and centers its text against it (mb-3 spacing is dropped;
|
|
48
|
+
// the centered box provides the gap to the value instead)
|
|
49
|
+
labelIconAlignSizes: { sm: "h-8", md: "h-10", lg: "h-10" },
|
|
50
|
+
labelSizes: {
|
|
51
|
+
sm: "text-xs font-medium tracking-tight",
|
|
52
|
+
md: "text-sm font-medium tracking-tight",
|
|
53
|
+
lg: "text-sm font-medium tracking-tight",
|
|
74
54
|
},
|
|
55
|
+
valueSizes: { sm: "text-xl", md: "text-3xl", lg: "text-3xl" },
|
|
56
|
+
subtitleSizes: { sm: "text-xs mt-1", md: "text-xs mt-0.5", lg: "text-sm mt-1" },
|
|
75
57
|
// Common element styles
|
|
76
|
-
labelStyle: "font-semibold text-[var(--color-text-
|
|
77
|
-
valueStyle: "font-
|
|
58
|
+
labelStyle: "font-semibold text-[var(--color-text-secondary)] mb-2",
|
|
59
|
+
valueStyle: "font-semibold text-[var(--color-text-primary)] tracking-tighter",
|
|
78
60
|
subtitleStyle: "text-[var(--color-text-secondary)]/80",
|
|
79
|
-
iconContainerStyle: "rounded-full flex items-center justify-center flex-shrink-0 p-
|
|
61
|
+
iconContainerStyle: "rounded-full flex items-center justify-center flex-shrink-0 p-2.5",
|
|
80
62
|
};
|
|
81
63
|
|
|
82
64
|
export { metricTheme };
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { SemanticColor } from '../../../utils/colorUtils';
|
|
3
3
|
export type MetricSize = 'sm' | 'md' | 'lg';
|
|
4
4
|
export type MetricColor = SemanticColor;
|
|
5
|
-
export type MetricVariant = 'filled' | 'glass';
|
|
5
|
+
export type MetricVariant = 'filled' | 'ghost' | 'glass';
|
|
6
6
|
export type TrendDirection = 'up' | 'down';
|
|
7
7
|
export interface MetricProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
/**
|
|
@@ -58,16 +58,15 @@ export interface MetricProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
58
58
|
export interface MetricTheme {
|
|
59
59
|
baseStyle: string;
|
|
60
60
|
variants: Record<MetricVariant, string>;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}>;
|
|
61
|
+
iconContainerVariants: Record<MetricVariant, string>;
|
|
62
|
+
iconColors: Record<MetricColor, string>;
|
|
63
|
+
iconGlassShadows: Record<MetricColor, string>;
|
|
64
|
+
contentPaddingSizes: Record<MetricSize, string>;
|
|
65
|
+
iconContainerSizes: Record<MetricSize, string>;
|
|
66
|
+
labelSizes: Record<MetricSize, string>;
|
|
67
|
+
labelIconAlignSizes: Record<MetricSize, string>;
|
|
68
|
+
valueSizes: Record<MetricSize, string>;
|
|
69
|
+
subtitleSizes: Record<MetricSize, string>;
|
|
71
70
|
labelStyle: string;
|
|
72
71
|
valueStyle: string;
|
|
73
72
|
subtitleStyle: string;
|
|
@@ -76,16 +75,15 @@ export interface MetricTheme {
|
|
|
76
75
|
export interface MetricThemeOverrides {
|
|
77
76
|
baseStyle?: string;
|
|
78
77
|
variants?: Partial<Record<MetricVariant, string>>;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}>>>;
|
|
78
|
+
iconContainerVariants?: Partial<Record<MetricVariant, string>>;
|
|
79
|
+
iconColors?: Partial<Record<MetricColor, string>>;
|
|
80
|
+
iconGlassShadows?: Partial<Record<MetricColor, string>>;
|
|
81
|
+
contentPaddingSizes?: Partial<Record<MetricSize, string>>;
|
|
82
|
+
iconContainerSizes?: Partial<Record<MetricSize, string>>;
|
|
83
|
+
labelSizes?: Partial<Record<MetricSize, string>>;
|
|
84
|
+
labelIconAlignSizes?: Partial<Record<MetricSize, string>>;
|
|
85
|
+
valueSizes?: Partial<Record<MetricSize, string>>;
|
|
86
|
+
subtitleSizes?: Partial<Record<MetricSize, string>>;
|
|
89
87
|
labelStyle?: string;
|
|
90
88
|
valueStyle?: string;
|
|
91
89
|
subtitleStyle?: string;
|
|
@@ -38,7 +38,7 @@ const TableContext = createContext({
|
|
|
38
38
|
*/
|
|
39
39
|
function TableComponent(props) {
|
|
40
40
|
var _a, _b;
|
|
41
|
-
const { data, columns, rowKey, variant = "default", padding = "default", theme: themeOverrides, className = "", freezeHeader = false, freezeFirstColumn = false, freezeLastColumn = false, sortable = false, sortConfig = [], onSortChange, filterable = false, filterConfig = [], onFilterChange, filterLogic: controlledFilterLogic, enableBuiltInFilter = false, expandable = false, expandedRowRender, expandedRows = [], onExpandedRowsChange, selectable = false, selectionType = "checkbox", selectedRows = [], onSelectionChange, bulkActions = [], showColumnManager = false, visibleColumns: initialVisibleColumns, onVisibleColumnsChange, onColumnReorder, pagination, children, caption, } = props;
|
|
41
|
+
const { data, columns, rowKey, onRowClick, variant = "default", padding = "default", theme: themeOverrides, className = "", freezeHeader = false, freezeFirstColumn = false, freezeLastColumn = false, sortable = false, sortConfig = [], onSortChange, filterable = false, filterConfig = [], onFilterChange, filterLogic: controlledFilterLogic, enableBuiltInFilter = false, expandable = false, expandedRowRender, expandedRows = [], onExpandedRowsChange, selectable = false, selectionType = "checkbox", selectedRows = [], onSelectionChange, bulkActions = [], showColumnManager = false, visibleColumns: initialVisibleColumns, onVisibleColumnsChange, onColumnReorder, pagination, children, caption, } = props;
|
|
42
42
|
// Column management hook
|
|
43
43
|
const { visibleColumns, columnOrder, visibleColumnsList, handleToggleColumn, handleColumnReorder, handleResetToDefault, } = useTableColumns({
|
|
44
44
|
columns,
|
|
@@ -149,7 +149,7 @@ function TableComponent(props) {
|
|
|
149
149
|
selectedRows,
|
|
150
150
|
onSelectionChange,
|
|
151
151
|
]);
|
|
152
|
-
return (jsx(TableContext.Provider, { value: contextValue, children: jsxs("div", { className: "relative", children: [!isDeclarativeAPI && columns && ((filterable && onFilterChange) || showColumnManager) && (jsxs("div", { className: theme.columnManagerContainer, children: [filterable && onFilterChange && (jsx(TableFilter, { columns: columns, filterConfig: filterConfig, onFilterChange: onFilterChange, filterLogic: filterLogic, onFilterLogicChange: handleFilterLogicChange, data: data })), showColumnManager && (jsx(TableColumnManager, { columns: columns, visibleColumns: visibleColumns, columnOrder: columnOrder, onToggleColumn: handleToggleColumn, onResetToDefault: handleResetToDefault, onColumnReorder: onColumnReorder ? handleColumnReorder : undefined }))] })), !isDeclarativeAPI && selectable && selectedRows.length > 0 && (jsx(TableSelectionHeader, { selectedCount: selectedRows.length, totalCount: paginatedData.length, selectedRows: selectedRows, bulkActions: bulkActions, onClearSelection: handleClearSelection })), jsx("div", { className: "overflow-x-auto", ref: scrollContainerRef, children: jsxs("table", { className: cn(baseClasses, variantClasses, paddingClasses, className), role: "table", "aria-label": isDeclarativeAPI ? "Data table" : `Data table with ${paginatedData.length} rows`, "aria-rowcount": pagination ? pagination.totalItems : data === null || data === void 0 ? void 0 : data.length, "aria-colcount": visibleColumnsList.length, children: [caption && (jsx("caption", { className: "sr-only", children: caption })), isDeclarativeAPI ? (children) : (jsxs(Fragment, { children: [jsx(TableHeader, { columns: visibleColumnsList, sortConfig: sortConfig, onSortChange: onSortChange, filterConfig: filterConfig, onFilterChange: onFilterChange, freezeHeader: freezeHeader, freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, expandable: expandable, expandedRowRender: expandedRowRender, selectable: selectable, selectionType: selectionType, selectedRows: selectedRows, onSelectionChange: onSelectionChange, totalRowCount: paginatedData.length, theme: theme, data: paginatedData, rowKey: rowKey }), jsx(TableBody, { data: paginatedData, columns: visibleColumnsList, rowKey: rowKey, expandedRowRender: expandedRowRender, expandedRows: expandedRows, onExpandedRowsChange: onExpandedRowsChange, selectable: selectable, selectionType: selectionType, selectedRows: selectedRows, onSelectionChange: onSelectionChange, freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, theme: theme })] }))] }) })] }) }));
|
|
152
|
+
return (jsx(TableContext.Provider, { value: contextValue, children: jsxs("div", { className: "relative", children: [!isDeclarativeAPI && columns && ((filterable && onFilterChange) || showColumnManager) && (jsxs("div", { className: theme.columnManagerContainer, children: [filterable && onFilterChange && (jsx(TableFilter, { columns: columns, filterConfig: filterConfig, onFilterChange: onFilterChange, filterLogic: filterLogic, onFilterLogicChange: handleFilterLogicChange, data: data })), showColumnManager && (jsx(TableColumnManager, { columns: columns, visibleColumns: visibleColumns, columnOrder: columnOrder, onToggleColumn: handleToggleColumn, onResetToDefault: handleResetToDefault, onColumnReorder: onColumnReorder ? handleColumnReorder : undefined }))] })), !isDeclarativeAPI && selectable && selectedRows.length > 0 && (jsx(TableSelectionHeader, { selectedCount: selectedRows.length, totalCount: paginatedData.length, selectedRows: selectedRows, bulkActions: bulkActions, onClearSelection: handleClearSelection })), jsx("div", { className: "overflow-x-auto", ref: scrollContainerRef, children: jsxs("table", { className: cn(baseClasses, variantClasses, paddingClasses, className), role: "table", "aria-label": isDeclarativeAPI ? "Data table" : `Data table with ${paginatedData.length} rows`, "aria-rowcount": pagination ? pagination.totalItems : data === null || data === void 0 ? void 0 : data.length, "aria-colcount": visibleColumnsList.length, children: [caption && (jsx("caption", { className: "sr-only", children: caption })), isDeclarativeAPI ? (children) : (jsxs(Fragment, { children: [jsx(TableHeader, { columns: visibleColumnsList, sortConfig: sortConfig, onSortChange: onSortChange, filterConfig: filterConfig, onFilterChange: onFilterChange, freezeHeader: freezeHeader, freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, expandable: expandable, expandedRowRender: expandedRowRender, selectable: selectable, selectionType: selectionType, selectedRows: selectedRows, onSelectionChange: onSelectionChange, totalRowCount: paginatedData.length, theme: theme, data: paginatedData, rowKey: rowKey }), jsx(TableBody, { data: paginatedData, columns: visibleColumnsList, rowKey: rowKey, onRowClick: onRowClick, expandedRowRender: expandedRowRender, expandedRows: expandedRows, onExpandedRowsChange: onExpandedRowsChange, selectable: selectable, selectionType: selectionType, selectedRows: selectedRows, onSelectionChange: onSelectionChange, freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, theme: theme })] }))] }) })] }) }));
|
|
153
153
|
}
|
|
154
154
|
TableComponent.displayName = "Table";
|
|
155
155
|
const Table = TableComponent;
|
|
@@ -5,12 +5,18 @@ const tableTheme = {
|
|
|
5
5
|
// Light: white background | Dark: neutral-900 background
|
|
6
6
|
baseStyle: "w-full border-separate border-spacing-0 text-sm",
|
|
7
7
|
// Variant styles
|
|
8
|
-
// Each variant gets dark mode border colors and alternate row colors
|
|
8
|
+
// Each variant gets dark mode border colors and alternate row colors.
|
|
9
|
+
// Non-grid variants (default/striped/compact) drop the bottom border on the
|
|
10
|
+
// last body row — the closing line is then carried by the surrounding card
|
|
11
|
+
// border, or by the pagination footer's `border-t` when pagination is shown.
|
|
12
|
+
// `bordered` is a full grid and keeps its closing edge.
|
|
9
13
|
variants: {
|
|
10
14
|
default: "border-[var(--color-border)] dark:border-[var(--color-neutral-700)] " +
|
|
15
|
+
"[&>tbody>tr:last-child>td]:border-b-0 " +
|
|
11
16
|
"[&_td]:px-3 [&_td]:py-2.5 [&_th]:px-3 [&_th]:py-2.5",
|
|
12
17
|
striped: "border-[var(--color-border)] dark:border-[var(--color-neutral-700)] " +
|
|
13
18
|
"[&>tbody>tr:nth-child(odd)]:bg-[var(--color-neutral-50)] dark:[&>tbody>tr:nth-child(odd)]:bg-[var(--color-neutral-800)] " +
|
|
19
|
+
"[&>tbody>tr:last-child>td]:border-b-0 " +
|
|
14
20
|
"[&_td]:px-3 [&_td]:py-2.5 [&_th]:px-3 [&_th]:py-2.5",
|
|
15
21
|
bordered: "border-t border-l border-[var(--color-border)] dark:border-[var(--color-neutral-700)] " +
|
|
16
22
|
"[&_td]:border-b [&_td]:border-r [&_th]:border-b [&_th]:border-r " +
|
|
@@ -18,6 +24,7 @@ const tableTheme = {
|
|
|
18
24
|
"dark:[&_td]:border-[var(--color-neutral-700)] dark:[&_th]:border-[var(--color-neutral-700)] " +
|
|
19
25
|
"[&_td]:px-3 [&_td]:py-2.5 [&_th]:px-3 [&_th]:py-2.5",
|
|
20
26
|
compact: "border-[var(--color-border)] dark:border-[var(--color-neutral-700)] " +
|
|
27
|
+
"[&>tbody>tr:last-child>td]:border-b-0 " +
|
|
21
28
|
"[&_td]:px-3 [&_td]:py-1 [&_th]:px-3 [&_th]:py-1",
|
|
22
29
|
},
|
|
23
30
|
// Edge-padding modes — applied at the table root via descendant selectors so they
|
|
@@ -28,12 +35,25 @@ const tableTheme = {
|
|
|
28
35
|
paddingStyles: {
|
|
29
36
|
default: "",
|
|
30
37
|
flush: "[&_th:first-child]:pl-0 [&_th:last-child]:pr-0 " +
|
|
31
|
-
"[&_td:first-child]:pl-0 [&_td:last-child]:pr-0"
|
|
38
|
+
"[&_td:first-child]:pl-0 [&_td:last-child]:pr-0 " +
|
|
39
|
+
// Hover inset on ONLY the hovered row's edge cells, with NO column reflow.
|
|
40
|
+
// Padding can't do this (a table shares one width per column across all
|
|
41
|
+
// rows, so padding one cell widens the whole column). Instead we shift the
|
|
42
|
+
// cell's content with `transform`, which is layout-free — it can't resize a
|
|
43
|
+
// column, so auto table-layout / responsive sizing is fully preserved and
|
|
44
|
+
// no other row moves. The row divider is moved from the cells onto the
|
|
45
|
+
// <tr> (inset shadow) so a shifted cell can't drag a notch into it.
|
|
46
|
+
"[&>tbody>tr>td]:border-b-0 " +
|
|
47
|
+
"[&>tbody>tr]:shadow-[inset_0_-1px_0_0_var(--color-border)] [&>tbody>tr:last-child]:shadow-none " +
|
|
48
|
+
"[&>tbody>tr>td]:transition-transform [&>tbody>tr>td]:duration-300 " +
|
|
49
|
+
// first cell eases right (its left padding); last cell eases left only when
|
|
50
|
+
// right-aligned (matches `pr-4` — invisible on left-aligned content).
|
|
51
|
+
"[&>tbody>tr:hover>td:first-child]:translate-x-2 " +
|
|
52
|
+
"[&>tbody>tr:hover>td:last-child.text-right]:-translate-x-2",
|
|
32
53
|
},
|
|
33
54
|
// Header styles
|
|
34
55
|
// Light: primary text, light border | Dark: neutral-200 text, neutral-700 border
|
|
35
|
-
headerStyle: "text-left
|
|
36
|
-
"text-[var(--color-text-secondary)]/80 text-sm border-[var(--color-border)] ",
|
|
56
|
+
headerStyle: "text-left sticky top-0 border-b first:pl-4 last:pr-4 text-[var(--color-text-primary)]/60 text-xs font-semibold border-[var(--color-border)] ",
|
|
37
57
|
// Cell styles — borders on cells (not rows) so sticky columns keep them
|
|
38
58
|
// Light: primary text | Dark: neutral-300 text
|
|
39
59
|
cellStyle: "border-b border-b-[var(--color-border)] first:pl-4 last:pr-4 " +
|
|
@@ -155,6 +155,12 @@ export interface TableProps<T = unknown> {
|
|
|
155
155
|
* Provides consistent component identity during row reordering or updates.
|
|
156
156
|
*/
|
|
157
157
|
rowKey?: keyof T | ((row: T, index: number) => string | number);
|
|
158
|
+
/**
|
|
159
|
+
* Row-level click handler (data-driven API). When provided, body rows get a
|
|
160
|
+
* pointer cursor, keyboard focus (Enter/Space activates), and call back with
|
|
161
|
+
* the row record. Selection/expansion controls stop propagation as before.
|
|
162
|
+
*/
|
|
163
|
+
onRowClick?: (row: T) => void;
|
|
158
164
|
/** Visual variant for different table styles */
|
|
159
165
|
variant?: TableVariant;
|
|
160
166
|
/**
|
|
@@ -267,6 +273,7 @@ export interface InternalTableBodyProps<T> {
|
|
|
267
273
|
data: T[];
|
|
268
274
|
columns: Column<T>[];
|
|
269
275
|
rowKey?: keyof T | ((row: T, index: number) => string | number);
|
|
276
|
+
onRowClick?: (row: T) => void;
|
|
270
277
|
expandedRowRender?: (row: T) => ReactNode;
|
|
271
278
|
expandedRows?: string[];
|
|
272
279
|
onExpandedRowsChange?: (expandedRows: string[]) => void;
|
|
@@ -282,6 +289,7 @@ export interface InternalTableRowProps<T> {
|
|
|
282
289
|
row: T;
|
|
283
290
|
rowId: string;
|
|
284
291
|
columns: Column<T>[];
|
|
292
|
+
onRowClick?: (row: T) => void;
|
|
285
293
|
expandedRowRender?: (row: T) => ReactNode;
|
|
286
294
|
isExpanded?: boolean;
|
|
287
295
|
onExpandChange?: (expanded: boolean) => void;
|
|
@@ -4,7 +4,7 @@ import { getRowId } from './Table.utils.js';
|
|
|
4
4
|
import { useTableExpansion } from './hooks/useTableExpansion.js';
|
|
5
5
|
import { useTableSelection } from './hooks/useTableSelection.js';
|
|
6
6
|
|
|
7
|
-
function TableBodyComponent({ data, columns, rowKey, expandedRowRender, expandedRows = [], onExpandedRowsChange, selectable, selectionType, selectedRows = [], onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }) {
|
|
7
|
+
function TableBodyComponent({ data, columns, rowKey, onRowClick, expandedRowRender, expandedRows = [], onExpandedRowsChange, selectable, selectionType, selectedRows = [], onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }) {
|
|
8
8
|
const { handleExpandChange } = useTableExpansion({
|
|
9
9
|
expandedRows,
|
|
10
10
|
onExpandedRowsChange,
|
|
@@ -18,7 +18,7 @@ function TableBodyComponent({ data, columns, rowKey, expandedRowRender, expanded
|
|
|
18
18
|
});
|
|
19
19
|
return (jsx("tbody", { children: data.map((row, index) => {
|
|
20
20
|
const rowId = getRowId(row, index, rowKey);
|
|
21
|
-
return (jsx(TableRow, { row: row, rowId: rowId, columns: columns, expandedRowRender: expandedRowRender, isExpanded: expandedRows.includes(rowId), onExpandChange: (expanded) => handleExpandChange(rowId, expanded), selectable: selectable, selectionType: selectionType, isSelected: selectedRows.includes(rowId), onSelectionChange: (selected) => handleSelectionChange(rowId, selected), freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, theme: theme }, rowId));
|
|
21
|
+
return (jsx(TableRow, { row: row, rowId: rowId, columns: columns, onRowClick: onRowClick, expandedRowRender: expandedRowRender, isExpanded: expandedRows.includes(rowId), onExpandChange: (expanded) => handleExpandChange(rowId, expanded), selectable: selectable, selectionType: selectionType, isSelected: selectedRows.includes(rowId), onSelectionChange: (selected) => handleSelectionChange(rowId, selected), freezeFirstColumn: freezeFirstColumn, freezeLastColumn: freezeLastColumn, theme: theme }, rowId));
|
|
22
22
|
}) }));
|
|
23
23
|
}
|
|
24
24
|
const TableBody = TableBodyComponent;
|
|
@@ -12,7 +12,7 @@ import { TableContext } from './Table.js';
|
|
|
12
12
|
*/
|
|
13
13
|
function TableCellComponent({ column, row, rowId, isHeader = false, isFrozen = false, isLastFrozen = false, isSelected = false, theme, children, }) {
|
|
14
14
|
const { isOverflowing } = useContext(TableContext);
|
|
15
|
-
const overflowFrozenStyle = isOverflowing ? "backdrop-blur-
|
|
15
|
+
const overflowFrozenStyle = isOverflowing ? "backdrop-blur-md" : undefined;
|
|
16
16
|
const Cell = isHeader ? 'th' : 'td';
|
|
17
17
|
const isUtilityColumn = column.id === UTILITY_COLUMN_ID;
|
|
18
18
|
// For header cells, render the column header content
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InternalTableRowProps } from "./Table.types";
|
|
2
|
-
declare function TableRowComponent<T extends Record<string, any>>({ row, rowId, columns, expandedRowRender, isExpanded, onExpandChange, selectable, selectionType, isSelected, onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }: InternalTableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function TableRowComponent<T extends Record<string, any>>({ row, rowId, columns, onRowClick, expandedRowRender, isExpanded, onExpandChange, selectable, selectionType, isSelected, onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }: InternalTableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace TableRowComponent {
|
|
4
4
|
var displayName: string;
|
|
5
5
|
}
|
|
@@ -10,14 +10,21 @@ import { UTILITY_COLUMN_WIDTH, UTILITY_COLUMN_ID } from './Table.utils.js';
|
|
|
10
10
|
import { cn } from '../../../utils/cn.js';
|
|
11
11
|
import { tableExpandAnimations, tableExpandContentAnimations } from './Table.animations.js';
|
|
12
12
|
|
|
13
|
-
function TableRowComponent({ row, rowId, columns, expandedRowRender, isExpanded = false, onExpandChange, selectable, selectionType, isSelected = false, onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }) {
|
|
13
|
+
function TableRowComponent({ row, rowId, columns, onRowClick, expandedRowRender, isExpanded = false, onExpandChange, selectable, selectionType, isSelected = false, onSelectionChange, freezeFirstColumn, freezeLastColumn, theme, }) {
|
|
14
14
|
const rowClasses = cn(theme === null || theme === void 0 ? void 0 : theme.rowStyle, isSelected && (theme === null || theme === void 0 ? void 0 : theme.selectedRowStyle));
|
|
15
15
|
const handleExpandClick = (e) => {
|
|
16
16
|
e.stopPropagation();
|
|
17
17
|
onExpandChange === null || onExpandChange === void 0 ? void 0 : onExpandChange(!isExpanded);
|
|
18
18
|
};
|
|
19
19
|
const colSpan = columns.length + (selectable || !!expandedRowRender ? 1 : 0);
|
|
20
|
-
return (jsxs(Fragment, { children: [jsxs("tr", { className: rowClasses, "data-selected": isSelected, role: "row", "aria-selected": selectable ? isSelected : undefined, "aria-expanded": Boolean(expandedRowRender) ? isExpanded : undefined,
|
|
20
|
+
return (jsxs(Fragment, { children: [jsxs("tr", { className: cn(rowClasses, onRowClick && "cursor-pointer"), "data-selected": isSelected, role: "row", "aria-selected": selectable ? isSelected : undefined, "aria-expanded": Boolean(expandedRowRender) ? isExpanded : undefined, tabIndex: onRowClick ? 0 : undefined, onClick: onRowClick ? () => onRowClick(row) : undefined, onKeyDown: onRowClick
|
|
21
|
+
? (e) => {
|
|
22
|
+
if (e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
onRowClick(row);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
: undefined, children: [(selectable || expandedRowRender) && (jsx(TableCell, { column: {
|
|
21
28
|
id: UTILITY_COLUMN_ID,
|
|
22
29
|
header: "",
|
|
23
30
|
accessor: () => "",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React__default, { useContext, createContext, useMemo } from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { timelineTheme } from './Timeline.theme.js';
|
|
@@ -14,7 +14,15 @@ const useTimelineContext = () => {
|
|
|
14
14
|
throw new Error("Timeline compound components must be used within <Timeline>");
|
|
15
15
|
return ctx;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Render a single data-driven item to the compound primitives. Keeps one
|
|
19
|
+
* rendering path: `items` and the compound API both produce `Timeline.Item`s.
|
|
20
|
+
*/
|
|
21
|
+
function renderItemData(item, index, theme) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return (jsxs(TimelineItem, { status: item.status, className: item.className, children: [jsx(TimelineMarker, { icon: item.icon }), jsx(TimelineContent, { children: (_a = item.content) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [item.title != null && (jsx("p", { className: theme.titleStyle, children: item.title })), item.description != null && (jsx("p", { className: theme.descriptionStyle, children: item.description })), item.timestamp != null && (jsx("p", { className: theme.timestampStyle, children: item.timestamp }))] })) })] }, (_b = item.key) !== null && _b !== void 0 ? _b : index));
|
|
24
|
+
}
|
|
25
|
+
const TimelineRoot = React__default.forwardRef(({ children, items, className, layout = "vertical", theme: themeOverrides, ...props }, ref) => {
|
|
18
26
|
// Merge theme with any overrides
|
|
19
27
|
const theme = useMemo(() => ({
|
|
20
28
|
...timelineTheme,
|
|
@@ -24,8 +32,22 @@ const TimelineRoot = React__default.forwardRef(({ children, className, layout =
|
|
|
24
32
|
...((themeOverrides === null || themeOverrides === void 0 ? void 0 : themeOverrides.markerStatuses) || {}),
|
|
25
33
|
},
|
|
26
34
|
}), [themeOverrides]);
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
if (process.env.NODE_ENV !== "production" &&
|
|
36
|
+
items &&
|
|
37
|
+
React__default.Children.count(children) > 0) {
|
|
38
|
+
console.warn("[Timeline]: both `items` and children were provided — `items` takes precedence and children are ignored.");
|
|
39
|
+
}
|
|
40
|
+
// Data-driven path renders to the same compound primitives as the
|
|
41
|
+
// composition path, so everything downstream is identical.
|
|
42
|
+
const baseChildren = items
|
|
43
|
+
? items.map((item, i) => renderItemData(item, i, theme))
|
|
44
|
+
: children;
|
|
45
|
+
// Inject each item's index from a single source of truth (the rendered
|
|
46
|
+
// children array) — no DOM measurement, no IntersectionObserver-derived order.
|
|
47
|
+
const indexedChildren = React__default.Children.map(baseChildren, (child, index) => React__default.isValidElement(child)
|
|
48
|
+
? React__default.cloneElement(child, { _index: index })
|
|
49
|
+
: child);
|
|
50
|
+
const totalItems = React__default.Children.count(baseChildren);
|
|
29
51
|
// Context value to be provided to children
|
|
30
52
|
const contextValue = useMemo(() => ({
|
|
31
53
|
layout,
|
|
@@ -33,7 +55,7 @@ const TimelineRoot = React__default.forwardRef(({ children, className, layout =
|
|
|
33
55
|
totalItems,
|
|
34
56
|
}), [layout, theme, totalItems]);
|
|
35
57
|
const isHorizontal = layout === "horizontal";
|
|
36
|
-
return (jsx(TimelineContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, className: cn(isHorizontal ? theme.baseStyleHorizontal : theme.baseStyle, className), "data-layout": layout, role: "list", "aria-label": "Timeline", ...props, children:
|
|
58
|
+
return (jsx(TimelineContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, className: cn(isHorizontal ? theme.baseStyleHorizontal : theme.baseStyle, className), "data-layout": layout, role: "list", "aria-label": "Timeline", ...props, children: indexedChildren }) }));
|
|
37
59
|
});
|
|
38
60
|
TimelineRoot.displayName = "Timeline";
|
|
39
61
|
// Attach compound subcomponents
|
|
@@ -7,12 +7,20 @@ export interface TimelineTheme {
|
|
|
7
7
|
baseStyleHorizontal: string;
|
|
8
8
|
itemStyle: string;
|
|
9
9
|
itemStyleHorizontal: string;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/** Connector line between markers — vertical layout */
|
|
11
|
+
connectorStyle: string;
|
|
12
|
+
/** Connector line between markers — horizontal layout */
|
|
13
|
+
connectorStyleHorizontal: string;
|
|
14
|
+
/** Color override applied to the connector when the item is completed */
|
|
15
|
+
connectorCompletedStyle: string;
|
|
12
16
|
markerStyle: string;
|
|
13
17
|
markerStatuses: Record<TimelineItemStatus, string>;
|
|
14
18
|
contentStyle: string;
|
|
15
19
|
contentStyleHorizontal: string;
|
|
20
|
+
/** Default typography for the data-driven (`items`) API content */
|
|
21
|
+
titleStyle: string;
|
|
22
|
+
descriptionStyle: string;
|
|
23
|
+
timestampStyle: string;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Default theme for Timeline components
|
|
@@ -11,22 +11,28 @@ const timelineTheme = {
|
|
|
11
11
|
itemStyle: "relative flex gap-4",
|
|
12
12
|
// Individual timeline item - horizontal
|
|
13
13
|
itemStyleHorizontal: "relative flex flex-col items-center flex-1 gap-3",
|
|
14
|
-
// Connector line - vertical (
|
|
15
|
-
|
|
16
|
-
// Connector line - horizontal
|
|
17
|
-
|
|
14
|
+
// Connector line - vertical (stretches down below the marker)
|
|
15
|
+
connectorStyle: "w-0.5 flex-1 min-h-4 bg-[var(--color-border)]",
|
|
16
|
+
// Connector line - horizontal (spans from this item's center to the next)
|
|
17
|
+
connectorStyleHorizontal: "absolute top-1/2 -translate-y-1/2 left-1/2 h-0.5 w-full bg-[var(--color-border)]",
|
|
18
|
+
// Completed connector color (overrides the base connector background)
|
|
19
|
+
connectorCompletedStyle: "bg-[var(--color-success)]",
|
|
18
20
|
// Marker base styles (shared across statuses)
|
|
19
|
-
markerStyle: "relative z-10 flex items-center justify-center shrink-0 rounded-full border-2 transition-colors duration-200",
|
|
21
|
+
markerStyle: "relative z-10 flex items-center justify-center shrink-0 rounded-full border-2 transition-colors duration-200 ring-4 ring-[var(--color-surface)] backdrop-blur-sm",
|
|
20
22
|
// Marker status-specific styles
|
|
21
23
|
markerStatuses: {
|
|
22
|
-
completed: "
|
|
23
|
-
active: "
|
|
24
|
-
pending: "
|
|
24
|
+
completed: "size-8 bg-[var(--color-success)] border-[var(--color-success)] text-[var(--color-success-contrast)]",
|
|
25
|
+
active: "size-8 bg-[var(--color-primary)]/0 border-[var(--color-primary)] text-[var(--color-primary)] ",
|
|
26
|
+
pending: "size-8 bg-[var(--color-background)] border-[var(--color-border)] text-[var(--color-text-muted)]",
|
|
25
27
|
},
|
|
26
28
|
// Content area - vertical
|
|
27
29
|
contentStyle: "pb-8 pt-0.5 min-w-0",
|
|
28
30
|
// Content area - horizontal
|
|
29
31
|
contentStyleHorizontal: "text-center px-2 min-w-0",
|
|
32
|
+
// Data-driven (`items`) content typography
|
|
33
|
+
titleStyle: "text-sm font-medium text-[var(--color-text-primary)]",
|
|
34
|
+
descriptionStyle: "text-sm text-[var(--color-text-secondary)] mt-1",
|
|
35
|
+
timestampStyle: "text-xs text-[var(--color-text-placeholder)] mt-1",
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
export { timelineTheme };
|