flikkui 0.2.0-beta.2 → 0.2.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai/PromptInput/PromptInput.js +23 -15
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.d.ts +27 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.js +62 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.d.ts +10 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +12 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.types.d.ts +53 -0
- package/dist/components/ai/PromptSuggestions/index.d.ts +4 -2
- package/dist/components/ai/index.d.ts +2 -12
- package/dist/components/charts/ActivityRings/ActivityRings.js +70 -58
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +0 -1
- package/dist/components/charts/ActivityRings/ActivityRings.types.d.ts +17 -0
- package/dist/components/charts/BarChart/BarChart.js +8 -4
- package/dist/components/charts/BarChart/BarChart.types.d.ts +14 -0
- package/dist/components/charts/DonutChart/DonutChart.js +11 -8
- package/dist/components/charts/DonutChart/DonutChart.theme.d.ts +3 -0
- package/dist/components/charts/DonutChart/DonutChart.theme.js +5 -4
- package/dist/components/charts/DonutChart/donut-utils.d.ts +5 -0
- package/dist/components/charts/DonutChart/donut-utils.js +26 -1
- package/dist/components/charts/Heatmap/Heatmap.theme.js +2 -2
- package/dist/components/charts/shared/ChartAxis/XAxis.d.ts +2 -2
- package/dist/components/charts/shared/ChartAxis/XAxis.js +4 -4
- package/dist/components/charts/shared/ChartAxis/YAxis.d.ts +2 -2
- package/dist/components/charts/shared/ChartAxis/YAxis.js +8 -7
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.d.ts +1 -1
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.js +2 -2
- package/dist/components/charts/theme/chart.theme.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +39 -39
- package/dist/components/core/Accordion/Accordion.d.ts +1 -1
- package/dist/components/core/Accordion/Accordion.js +2 -2
- package/dist/components/core/Accordion/Accordion.types.d.ts +8 -0
- package/dist/components/core/Badge/Badge.js +11 -15
- package/dist/components/core/Badge/Badge.theme.js +7 -21
- package/dist/components/core/Badge/Badge.types.d.ts +9 -1
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.theme.js +1 -1
- package/dist/components/core/Button/Button.types.d.ts +8 -0
- package/dist/components/core/Card/Card.js +8 -2
- package/dist/components/core/Card/Card.theme.js +1 -1
- package/dist/components/core/Card/Card.types.d.ts +24 -1
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +10 -40
- package/dist/components/core/Drawer/Drawer.theme.js +2 -1
- package/dist/components/core/Drawer/Drawer.types.d.ts +8 -0
- package/dist/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.js +2 -2
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +8 -0
- package/dist/components/core/Metric/Metric.d.ts +1 -1
- package/dist/components/core/Metric/Metric.js +9 -5
- package/dist/components/core/Metric/Metric.theme.d.ts +1 -1
- package/dist/components/core/Metric/Metric.theme.js +38 -28
- package/dist/components/core/Metric/Metric.types.d.ts +27 -8
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +17 -40
- package/dist/components/core/Modal/Modal.theme.js +8 -3
- package/dist/components/core/Modal/Modal.types.d.ts +18 -0
- package/dist/components/core/Modal/index.d.ts +1 -1
- package/dist/components/core/Notification/Notification.js +2 -0
- package/dist/components/core/Pill/Pill.d.ts +6 -11
- package/dist/components/core/Pill/Pill.theme.d.ts +2 -2
- package/dist/components/core/Pill/Pill.types.d.ts +9 -22
- package/dist/components/core/Pill/index.d.ts +1 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/Popover.js +2 -2
- package/dist/components/core/Popover/Popover.types.d.ts +8 -0
- package/dist/components/core/Progress/Progress.d.ts +28 -0
- package/dist/components/core/Progress/Progress.js +114 -0
- package/dist/components/core/Progress/Progress.theme.d.ts +5 -0
- package/dist/components/core/Progress/Progress.theme.js +33 -0
- package/dist/components/core/Progress/Progress.types.d.ts +92 -0
- package/dist/components/core/Progress/index.d.ts +2 -0
- package/dist/components/core/Tabs/Tabs.js +2 -2
- package/dist/components/core/Tabs/Tabs.types.d.ts +8 -0
- package/dist/components/core/Tag/Tag.animations.d.ts +3 -0
- package/dist/components/core/Tag/Tag.animations.js +31 -0
- package/dist/components/core/Tag/Tag.d.ts +14 -0
- package/dist/components/core/Tag/Tag.js +45 -0
- package/dist/components/core/Tag/Tag.theme.d.ts +2 -0
- package/dist/components/core/Tag/Tag.theme.js +21 -0
- package/dist/components/core/Tag/Tag.types.d.ts +40 -0
- package/dist/components/core/Tag/index.d.ts +3 -0
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +3 -3
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +17 -0
- package/dist/components/core/index.d.ts +2 -1
- package/dist/components/core/index.js +3 -2
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +0 -13
- package/dist/components/effects/CustomCursor/CustomCursor.js +26 -2
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +12 -1
- package/dist/components/effects/CustomCursor/CustomCursor.types.d.ts +14 -1
- package/dist/components/forms/Combobox/Combobox.d.ts +25 -0
- package/dist/components/forms/Combobox/Combobox.js +412 -0
- package/dist/components/forms/Combobox/Combobox.theme.d.ts +6 -0
- package/dist/components/forms/Combobox/Combobox.theme.js +60 -0
- package/dist/components/forms/Combobox/Combobox.types.d.ts +111 -0
- package/dist/components/forms/Combobox/index.d.ts +3 -0
- package/dist/components/forms/FileUpload/FileUpload.js +2 -0
- package/dist/components/forms/Input/Input.js +25 -28
- package/dist/components/forms/Input/inputMasks.d.ts +15 -0
- package/dist/components/forms/Input/inputMasks.js +72 -1
- package/dist/components/forms/InputTag/InputTag.d.ts +40 -0
- package/dist/components/forms/InputTag/InputTag.js +491 -0
- package/dist/components/forms/InputTag/InputTag.theme.d.ts +2 -0
- package/dist/components/forms/InputTag/InputTag.theme.js +16 -0
- package/dist/components/forms/InputTag/InputTag.types.d.ts +107 -0
- package/dist/components/forms/InputTag/index.d.ts +3 -0
- package/dist/components/forms/Select/Select.d.ts +101 -2
- package/dist/components/forms/Select/Select.js +128 -132
- package/dist/components/forms/Select/Select.theme.js +10 -14
- package/dist/components/forms/Select/Select.types.d.ts +6 -2
- package/dist/components/forms/Select/index.d.ts +7 -4
- package/dist/components/forms/Select/useSelectState.d.ts +66 -0
- package/dist/components/forms/Select/useSelectState.js +134 -0
- package/dist/components/forms/SelectExpand/SelectExpand.animations.d.ts +20 -0
- package/dist/components/forms/SelectExpand/SelectExpand.animations.js +74 -0
- package/dist/components/forms/SelectExpand/SelectExpand.d.ts +9 -0
- package/dist/components/forms/SelectExpand/SelectExpand.js +223 -0
- package/dist/components/forms/SelectExpand/SelectExpand.theme.d.ts +5 -0
- package/dist/components/forms/SelectExpand/SelectExpand.theme.js +74 -0
- package/dist/components/forms/SelectExpand/SelectExpand.types.d.ts +126 -0
- package/dist/components/forms/SelectExpand/index.d.ts +4 -0
- package/dist/components/forms/Switch/Switch.js +3 -3
- package/dist/components/forms/Switch/Switch.theme.d.ts +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +2 -2
- package/dist/components/forms/TimePicker/TimePicker.animations.d.ts +0 -46
- package/dist/components/forms/TimePicker/TimePicker.d.ts +15 -6
- package/dist/components/forms/TimePicker/TimePicker.js +285 -124
- package/dist/components/forms/TimePicker/TimePicker.theme.d.ts +1 -1
- package/dist/components/forms/TimePicker/TimePicker.theme.js +39 -22
- package/dist/components/forms/TimePicker/TimePicker.types.d.ts +88 -34
- package/dist/components/forms/TimePicker/TimePickerContent.d.ts +7 -10
- package/dist/components/forms/TimePicker/TimePickerContent.js +149 -16
- package/dist/components/forms/TimePicker/TimePickerTrigger.d.ts +3 -3
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +22 -19
- package/dist/components/forms/TimePicker/WheelColumn.d.ts +14 -0
- package/dist/components/forms/TimePicker/WheelColumn.js +90 -0
- package/dist/components/forms/TimePicker/index.d.ts +4 -1
- package/dist/components/forms/TimePicker/useWheelPicker.d.ts +37 -0
- package/dist/components/forms/TimePicker/useWheelPicker.js +138 -0
- package/dist/components/forms/forms.theme.d.ts +14 -0
- package/dist/components/forms/forms.theme.js +31 -0
- package/dist/components/forms/index.d.ts +9 -3
- package/dist/components/forms/index.js +73 -2
- package/dist/hooks/index.d.ts +0 -4
- package/dist/icons/Icon.d.ts +7 -0
- package/dist/icons/Icon.js +6 -2
- package/dist/index.js +12 -16
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/optimisticErrors.js +1 -70
- package/package.json +1 -1
- package/dist/components/ai/EditingIndicator/EditingIndicator.animations.d.ts +0 -31
- package/dist/components/ai/EditingIndicator/EditingIndicator.animations.js +0 -115
- package/dist/components/ai/EditingIndicator/EditingIndicator.d.ts +0 -35
- package/dist/components/ai/EditingIndicator/EditingIndicator.js +0 -94
- package/dist/components/ai/EditingIndicator/EditingIndicator.theme.d.ts +0 -2
- package/dist/components/ai/EditingIndicator/EditingIndicator.theme.js +0 -13
- package/dist/components/ai/EditingIndicator/EditingIndicator.types.d.ts +0 -54
- package/dist/components/ai/EditingIndicator/index.d.ts +0 -9
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.d.ts +0 -3
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.js +0 -126
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.theme.d.ts +0 -2
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.theme.js +0 -8
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.types.d.ts +0 -45
- package/dist/components/ai/GenerativeRenderer/index.d.ts +0 -3
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.animations.d.ts +0 -17
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.animations.js +0 -56
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.d.ts +0 -38
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.js +0 -110
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.theme.d.ts +0 -2
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.theme.js +0 -13
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.types.d.ts +0 -53
- package/dist/components/ai/PresenceIndicator/index.d.ts +0 -8
- package/dist/components/ai/PresenceProvider/PresenceContext.d.ts +0 -24
- package/dist/components/ai/PresenceProvider/PresenceContext.js +0 -34
- package/dist/components/ai/PresenceProvider/PresenceProvider.d.ts +0 -32
- package/dist/components/ai/PresenceProvider/PresenceProvider.js +0 -321
- package/dist/components/ai/PresenceProvider/PresenceProvider.types.d.ts +0 -140
- package/dist/components/ai/PresenceProvider/adapters/MockAdapter.d.ts +0 -102
- package/dist/components/ai/PresenceProvider/adapters/MockAdapter.js +0 -331
- package/dist/components/ai/PresenceProvider/adapters/PresenceAdapter.d.ts +0 -93
- package/dist/components/ai/PresenceProvider/adapters/SupabaseAdapter.d.ts +0 -134
- package/dist/components/ai/PresenceProvider/adapters/WebSocketAdapter.d.ts +0 -149
- package/dist/components/ai/PresenceProvider/adapters/index.d.ts +0 -11
- package/dist/components/ai/PresenceProvider/index.d.ts +0 -10
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.d.ts +0 -27
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.js +0 -61
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.types.d.ts +0 -65
- package/dist/components/ai/VersionSlider/VersionSlider.d.ts +0 -3
- package/dist/components/ai/VersionSlider/VersionSlider.js +0 -97
- package/dist/components/ai/VersionSlider/VersionSlider.theme.d.ts +0 -2
- package/dist/components/ai/VersionSlider/VersionSlider.theme.js +0 -18
- package/dist/components/ai/VersionSlider/VersionSlider.types.d.ts +0 -77
- package/dist/components/ai/VersionSlider/index.d.ts +0 -3
- package/dist/components/core/Pill/Pill.animations.js +0 -25
- package/dist/components/core/Pill/Pill.js +0 -145
- package/dist/components/core/Pill/Pill.theme.js +0 -65
- package/dist/components/core/RetryBoundary/RetryBoundary.d.ts +0 -35
- package/dist/components/core/RetryBoundary/RetryBoundary.js +0 -154
- package/dist/components/core/RetryBoundary/RetryBoundary.theme.d.ts +0 -2
- package/dist/components/core/RetryBoundary/RetryBoundary.theme.js +0 -7
- package/dist/components/core/RetryBoundary/RetryBoundary.types.d.ts +0 -51
- package/dist/components/core/RetryBoundary/index.d.ts +0 -3
- package/dist/components/forms/OptimisticForm/OptimisticForm.d.ts +0 -33
- package/dist/components/forms/OptimisticForm/OptimisticForm.js +0 -87
- package/dist/components/forms/OptimisticForm/OptimisticForm.theme.d.ts +0 -2
- package/dist/components/forms/OptimisticForm/OptimisticForm.theme.js +0 -8
- package/dist/components/forms/OptimisticForm/OptimisticForm.types.d.ts +0 -74
- package/dist/components/forms/OptimisticForm/index.d.ts +0 -3
- package/dist/hooks/useOptimisticMutation.d.ts +0 -109
- package/dist/hooks/useOptimisticMutation.js +0 -171
- package/dist/hooks/usePresence.d.ts +0 -88
- package/dist/utils/presenceUtils.d.ts +0 -66
- package/dist/utils/presenceUtils.js +0 -107
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared utility functions for DonutChart components
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a CSS variable to its computed value
|
|
6
|
+
* Falls back to the provided value if not a CSS variable or resolution fails
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveCssVariable: (value: string, fallback?: string) => string;
|
|
4
9
|
/**
|
|
5
10
|
* Clamps a value between a minimum and maximum
|
|
6
11
|
*/
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared utility functions for DonutChart components
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a CSS variable to its computed value
|
|
6
|
+
* Falls back to the provided value if not a CSS variable or resolution fails
|
|
7
|
+
*/
|
|
8
|
+
const resolveCssVariable = (value, fallback) => {
|
|
9
|
+
var _a;
|
|
10
|
+
// If not a CSS variable, return as-is
|
|
11
|
+
if (!value.startsWith("var(")) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
// Check if we're in a browser environment
|
|
15
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
16
|
+
return fallback || value;
|
|
17
|
+
}
|
|
18
|
+
// Extract variable name from var(--name) or var(--name, fallback)
|
|
19
|
+
const match = value.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);
|
|
20
|
+
if (!match) {
|
|
21
|
+
return fallback || value;
|
|
22
|
+
}
|
|
23
|
+
const varName = match[1].trim();
|
|
24
|
+
const cssDefault = (_a = match[2]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
25
|
+
// Get computed value from document root
|
|
26
|
+
const computed = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
27
|
+
return computed || cssDefault || fallback || value;
|
|
28
|
+
};
|
|
4
29
|
/**
|
|
5
30
|
* Clamps a value between a minimum and maximum
|
|
6
31
|
*/
|
|
@@ -112,4 +137,4 @@ const interpolateHexColor = (from, to, factor) => {
|
|
|
112
137
|
return `rgb(${r}, ${g}, ${b})`;
|
|
113
138
|
};
|
|
114
139
|
|
|
115
|
-
export { clamp, describeArcPathClockwise, describeRingSegmentPath, hexToRgb, interpolateHexColor, polarToCartesian };
|
|
140
|
+
export { clamp, describeArcPathClockwise, describeRingSegmentPath, hexToRgb, interpolateHexColor, polarToCartesian, resolveCssVariable };
|
|
@@ -9,8 +9,8 @@ const heatmapTheme = {
|
|
|
9
9
|
gridStyle: "absolute inset-0",
|
|
10
10
|
// Base cell styles (individual cells add opacity via inline styles)
|
|
11
11
|
cellBaseStyle: "relative w-full h-full cursor-pointer border border-transparent transition-all duration-500 animate-[flicker_0.6s_ease-out_forwards]",
|
|
12
|
-
// Axis labels using
|
|
13
|
-
axisLabelStyle: "text-xs text-
|
|
12
|
+
// Axis labels using CSS variables for dark mode support
|
|
13
|
+
axisLabelStyle: "text-xs text-[var(--color-text-secondary)] font-medium select-none",
|
|
14
14
|
// Legend using correct CSS variables
|
|
15
15
|
legendStyle: "w-full space-y-1.5 mt-3",
|
|
16
16
|
};
|
|
@@ -6,7 +6,7 @@ import { ChartText } from '../ChartText/ChartText.js';
|
|
|
6
6
|
* XAxis component for charts
|
|
7
7
|
* Renders horizontal axis with labels and optional tick marks
|
|
8
8
|
*/
|
|
9
|
-
const XAxis = ({ data, x, y, width, categoryWidth, categoryGap = 0, show = true, className, color =
|
|
9
|
+
const XAxis = ({ data, x, y, width, categoryWidth, categoryGap = 0, show = true, className, color = "currentColor", showTicks = true, tickLength = 6, tickPadding = 12, textAnchor = "middle", labelRotation = 0, labelFormatter, maxLabelWidth = 100, alignWithEdge = false, }) => {
|
|
10
10
|
if (!show)
|
|
11
11
|
return null;
|
|
12
12
|
const formatLabel = (item, index) => {
|
|
@@ -25,13 +25,13 @@ const XAxis = ({ data, x, y, width, categoryWidth, categoryGap = 0, show = true,
|
|
|
25
25
|
}
|
|
26
26
|
return x + index * (categoryWidth + categoryGap) + categoryWidth / 2;
|
|
27
27
|
};
|
|
28
|
-
return (React__default.createElement("g", { className: cn(
|
|
29
|
-
React__default.createElement("line", { x1: x, y1: y, x2: x + width, y2: y,
|
|
28
|
+
return (React__default.createElement("g", { className: cn("chart-x-axis", className) },
|
|
29
|
+
React__default.createElement("line", { x1: x, y1: y, x2: x + width, y2: y, className: "stroke-[var(--color-border)]", strokeWidth: 1 }),
|
|
30
30
|
data.map((item, index) => {
|
|
31
31
|
const tickX = getTickX(index);
|
|
32
32
|
const label = formatLabel(item, index);
|
|
33
33
|
return (React__default.createElement("g", { key: index },
|
|
34
|
-
showTicks && (React__default.createElement("line", { x1: tickX, y1: y, x2: tickX, y2: y + tickLength,
|
|
34
|
+
showTicks && (React__default.createElement("line", { x1: tickX, y1: y, x2: tickX, y2: y + tickLength, className: "stroke-[var(--color-border)]", strokeWidth: 1 })),
|
|
35
35
|
React__default.createElement(ChartText, { x: tickX, y: y + tickLength + tickPadding, textAnchor: textAnchor, maxWidth: maxLabelWidth, truncate: !!maxLabelWidth, rotation: labelRotation }, label)));
|
|
36
36
|
})));
|
|
37
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { YAxisProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { YAxisProps } from "./ChartAxis.types";
|
|
3
3
|
/**
|
|
4
4
|
* YAxis component for charts
|
|
5
5
|
* Renders vertical axis with labels, optional tick marks, and grid lines
|
|
@@ -6,7 +6,7 @@ import { ChartText } from '../ChartText/ChartText.js';
|
|
|
6
6
|
* YAxis component for charts
|
|
7
7
|
* Renders vertical axis with labels, optional tick marks, and grid lines
|
|
8
8
|
*/
|
|
9
|
-
const YAxis = ({ min, max, tickCount = 5, x, y, height, show = true, className, color =
|
|
9
|
+
const YAxis = ({ min, max, tickCount = 5, x, y, height, show = true, className, color = "currentColor", showTicks = true, tickLength = 6, tickPadding = 8, textAnchor = "end", tickFormatter, showGrid = false, gridWidth = 0, ticks: customTicks, }) => {
|
|
10
10
|
if (!show)
|
|
11
11
|
return null;
|
|
12
12
|
// Generate tick values
|
|
@@ -68,7 +68,8 @@ const YAxis = ({ min, max, tickCount = 5, x, y, height, show = true, className,
|
|
|
68
68
|
else if (Math.abs(value) >= 1000) {
|
|
69
69
|
return `${Math.round(value / 1000)}K`;
|
|
70
70
|
}
|
|
71
|
-
else if (Number.isInteger(value) ||
|
|
71
|
+
else if (Number.isInteger(value) ||
|
|
72
|
+
Math.abs(value - Math.round(value)) < 0.01) {
|
|
72
73
|
return Math.round(value).toString();
|
|
73
74
|
}
|
|
74
75
|
else {
|
|
@@ -80,15 +81,15 @@ const YAxis = ({ min, max, tickCount = 5, x, y, height, show = true, className,
|
|
|
80
81
|
return y + height / 2; // Center position when no range
|
|
81
82
|
}
|
|
82
83
|
const ratio = (value - min) / (max - min);
|
|
83
|
-
return y + height -
|
|
84
|
+
return y + height - ratio * height;
|
|
84
85
|
};
|
|
85
|
-
return (React__default.createElement("g", { className: cn(
|
|
86
|
-
React__default.createElement("line", { x1: x, y1: y, x2: x, y2: y + height,
|
|
86
|
+
return (React__default.createElement("g", { className: cn("chart-y-axis", className) },
|
|
87
|
+
React__default.createElement("line", { x1: x, y1: y, x2: x, y2: y + height, className: "stroke-[var(--color-border)]", strokeWidth: 1 }),
|
|
87
88
|
ticks.map((tick, index) => {
|
|
88
89
|
const tickY = getTickY(tick);
|
|
89
90
|
return (React__default.createElement("g", { key: index },
|
|
90
|
-
showGrid && gridWidth > 0 && (React__default.createElement("line", { x1: x, y1: tickY, x2: x + gridWidth, y2: tickY,
|
|
91
|
-
showTicks && (React__default.createElement("line", { x1: x - tickLength, y1: tickY, x2: x, y2: tickY,
|
|
91
|
+
showGrid && gridWidth > 0 && (React__default.createElement("line", { x1: x, y1: tickY, x2: x + gridWidth, y2: tickY, className: "opacity-80 stroke-[var(--color-border)]", strokeWidth: 1 })),
|
|
92
|
+
showTicks && (React__default.createElement("line", { x1: x - tickLength, y1: tickY, x2: x, y2: tickY, className: "stroke-[var(--color-border)]", strokeWidth: 1 })),
|
|
92
93
|
React__default.createElement(ChartText, { x: x - tickLength - tickPadding, y: tickY, textAnchor: textAnchor, dominantBaseline: "middle" }, formatTick(tick))));
|
|
93
94
|
})));
|
|
94
95
|
};
|
|
@@ -5,7 +5,7 @@ import { cn } from '../../../../utils/cn.js';
|
|
|
5
5
|
* HorizontalGrid component for charts
|
|
6
6
|
* Renders horizontal grid lines at specified intervals
|
|
7
7
|
*/
|
|
8
|
-
const HorizontalGrid = ({ x, y, width, height, lineCount = 5, show = true, color =
|
|
8
|
+
const HorizontalGrid = ({ x, y, width, height, lineCount = 5, show = true, color = "currentColor", className, tickPositions, }) => {
|
|
9
9
|
if (!show)
|
|
10
10
|
return null;
|
|
11
11
|
// Generate grid line positions
|
|
@@ -15,7 +15,7 @@ const HorizontalGrid = ({ x, y, width, height, lineCount = 5, show = true, color
|
|
|
15
15
|
return y;
|
|
16
16
|
return y + (i * height) / (lineCount - 1);
|
|
17
17
|
});
|
|
18
|
-
return (React__default.createElement("g", { className: cn(
|
|
18
|
+
return (React__default.createElement("g", { className: cn("chart-horizontal-grid", className) }, positions.map((lineY, index) => (React__default.createElement("line", { key: index, x1: x, y1: lineY, x2: x + width, y2: lineY, className: "opacity-80 stroke-[var(--color-border)]", strokeWidth: 1 })))));
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export { HorizontalGrid };
|
|
@@ -7,64 +7,64 @@ const chartTheme = {
|
|
|
7
7
|
colors: {
|
|
8
8
|
// Default series colors using your design system colors
|
|
9
9
|
series: [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
"fill-[var(--color-primary)] stroke-[var(--color-primary)]", // Primary
|
|
11
|
+
"fill-[var(--color-warning)] stroke-[var(--color-warning)]", // Warning/Orange
|
|
12
|
+
"fill-[var(--color-success)] stroke-[var(--color-success)]", // Success/Green
|
|
13
|
+
"fill-[var(--color-danger)] stroke-[var(--color-danger)]", // Danger/Red
|
|
14
|
+
"fill-[var(--color-primary-400)] stroke-[var(--color-primary-400)]", // Primary lighter
|
|
15
|
+
"fill-[var(--color-warning-400)] stroke-[var(--color-warning-400)]", // Warning lighter
|
|
16
|
+
"fill-[var(--color-success-400)] stroke-[var(--color-success-400)]", // Success lighter
|
|
17
|
+
"fill-[var(--color-danger-400)] stroke-[var(--color-danger-400)]", // Danger lighter
|
|
18
18
|
],
|
|
19
19
|
// Chart infrastructure colors
|
|
20
|
-
grid:
|
|
21
|
-
axis:
|
|
22
|
-
text:
|
|
23
|
-
background:
|
|
24
|
-
hover:
|
|
25
|
-
disabled:
|
|
20
|
+
grid: "stroke-[var(--color-border)]",
|
|
21
|
+
axis: "stroke-[var(--color-border)]",
|
|
22
|
+
text: "fill-[var(--color-text-secondary)]",
|
|
23
|
+
background: "fill-[var(--color-background)]",
|
|
24
|
+
hover: "fill-[var(--color-background-secondary)]",
|
|
25
|
+
disabled: "fill-[var(--color-background-disabled)]",
|
|
26
26
|
},
|
|
27
27
|
opacity: {
|
|
28
|
-
default:
|
|
29
|
-
hover:
|
|
30
|
-
disabled:
|
|
28
|
+
default: "opacity-100",
|
|
29
|
+
hover: "opacity-80",
|
|
30
|
+
disabled: "opacity-50",
|
|
31
31
|
},
|
|
32
32
|
transitions: {
|
|
33
|
-
default:
|
|
34
|
-
hover:
|
|
33
|
+
default: "transition-all duration-200",
|
|
34
|
+
hover: "transition-all duration-150",
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
variants: {
|
|
38
38
|
default: {
|
|
39
39
|
colors: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
"fill-[var(--color-primary)] stroke-[var(--color-primary)]",
|
|
41
|
+
"fill-[var(--color-warning)] stroke-[var(--color-warning)]",
|
|
42
|
+
"fill-[var(--color-success)] stroke-[var(--color-success)]",
|
|
43
|
+
"fill-[var(--color-danger)] stroke-[var(--color-danger)]",
|
|
44
|
+
"fill-[var(--color-primary-400)] stroke-[var(--color-primary-400)]",
|
|
45
|
+
"fill-[var(--color-warning-400)] stroke-[var(--color-warning-400)]",
|
|
46
|
+
"fill-[var(--color-success-400)] stroke-[var(--color-success-400)]",
|
|
47
|
+
"fill-[var(--color-danger-400)] stroke-[var(--color-danger-400)]",
|
|
48
48
|
],
|
|
49
49
|
},
|
|
50
50
|
minimal: {
|
|
51
51
|
colors: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
"fill-[var(--color-neutral-600)] stroke-[var(--color-neutral-600)]",
|
|
53
|
+
"fill-[var(--color-neutral-500)] stroke-[var(--color-neutral-500)]",
|
|
54
|
+
"fill-[var(--color-neutral-400)] stroke-[var(--color-neutral-400)]",
|
|
55
|
+
"fill-[var(--color-neutral-300)] stroke-[var(--color-neutral-300)]",
|
|
56
|
+
"fill-[var(--color-neutral-700)] stroke-[var(--color-neutral-700)]",
|
|
57
|
+
"fill-[var(--color-neutral-800)] stroke-[var(--color-neutral-800)]",
|
|
58
58
|
],
|
|
59
59
|
},
|
|
60
60
|
gradient: {
|
|
61
61
|
colors: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
"fill-[var(--color-primary)] stroke-[var(--color-primary)]",
|
|
63
|
+
"fill-[var(--color-primary-400)] stroke-[var(--color-primary-400)]",
|
|
64
|
+
"fill-[var(--color-primary-500)] stroke-[var(--color-primary-500)]",
|
|
65
|
+
"fill-[var(--color-primary-600)] stroke-[var(--color-primary-600)]",
|
|
66
|
+
"fill-[var(--color-primary-700)] stroke-[var(--color-primary-700)]",
|
|
67
|
+
"fill-[var(--color-primary-800)] stroke-[var(--color-primary-800)]",
|
|
68
68
|
],
|
|
69
69
|
},
|
|
70
70
|
},
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { AccordionProps, AccordionContextValue } from "./Accordion.types";
|
|
3
3
|
export declare const useAccordionContext: () => AccordionContextValue;
|
|
4
4
|
export declare const Accordion: {
|
|
5
|
-
({ children, className, type, variant, collapsible, defaultValue, value, onValueChange, theme: themeOverrides, ...props }: AccordionProps): React.JSX.Element;
|
|
5
|
+
({ children, className, type, variant, collapsible, defaultValue, value, onValueChange, theme: themeOverrides, darkMode, ...props }: AccordionProps): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
} & {
|
|
8
8
|
Item: React.ForwardRefExoticComponent<import("./Accordion.types").AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -13,7 +13,7 @@ const useAccordionContext = () => {
|
|
|
13
13
|
throw new Error("Accordion compound components must be used within <Accordion>");
|
|
14
14
|
return ctx;
|
|
15
15
|
};
|
|
16
|
-
const AccordionRoot = ({ children, className, type = "single", variant = "separated", collapsible = false, defaultValue, value, onValueChange, theme: themeOverrides, ...props }) => {
|
|
16
|
+
const AccordionRoot = ({ children, className, type = "single", variant = "separated", collapsible = false, defaultValue, value, onValueChange, theme: themeOverrides, darkMode = false, ...props }) => {
|
|
17
17
|
// State for uncontrolled component
|
|
18
18
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue || (type === "single" ? "" : []));
|
|
19
19
|
// Determine if component is controlled
|
|
@@ -43,7 +43,7 @@ const AccordionRoot = ({ children, className, type = "single", variant = "separa
|
|
|
43
43
|
// Select base style based on variant
|
|
44
44
|
const baseStyleClass = variant === "stacked" ? theme.baseStyleStacked : theme.baseStyle;
|
|
45
45
|
return (React__default.createElement(AccordionContext.Provider, { value: contextValue },
|
|
46
|
-
React__default.createElement("div", { className: cn(baseStyleClass, className), "data-variant": variant, ...props }, children)));
|
|
46
|
+
React__default.createElement("div", { className: cn(baseStyleClass, darkMode && "dark", className), "data-variant": variant, ...props }, children)));
|
|
47
47
|
};
|
|
48
48
|
AccordionRoot.displayName = "Accordion";
|
|
49
49
|
// Attach compound subcomponents
|
|
@@ -32,6 +32,14 @@ export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
32
32
|
*/
|
|
33
33
|
theme?: AccordionThemeOverrides;
|
|
34
34
|
children: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Force dark mode styling for the component. Use when placing the component
|
|
37
|
+
* on a dark background while the page is in light mode. This applies the
|
|
38
|
+
* 'dark' class to the container, making text, borders, and other elements
|
|
39
|
+
* use light colors for visibility.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
darkMode?: boolean;
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
37
45
|
* Accordion context value
|
|
@@ -30,8 +30,8 @@ const getShouldAnimate = () => {
|
|
|
30
30
|
* <Badge dismissible onDismiss={handleDismiss}>Removable</Badge>
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
const Badge = React__default.memo(React__default.forwardRef(({ children, variant = "filled", color = "primary", size = "md", pill = false, withDot = false, iconStart, avatar, dismissible = false, onDismiss, selectable = false, selected = false, onSelect, disabled = false, maxWidth, className, theme: customTheme = {}, onClick, ...props }, ref) => {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
33
|
+
const Badge = React__default.memo(React__default.forwardRef(({ children, variant = "filled", color = "primary", size = "md", pill = false, withDot = false, iconStart, avatar, dismissible = false, onDismiss, selectable = false, selected = false, onSelect, disabled = false, maxWidth, className, theme: customTheme = {}, onClick, darkMode = false, ...props }, ref) => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
35
35
|
// State management
|
|
36
36
|
const [isVisible, setIsVisible] = useState(true);
|
|
37
37
|
const [isSelected, setIsSelected] = useState(selected);
|
|
@@ -93,10 +93,6 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
93
93
|
...(_e = badgeTheme.variantColors) === null || _e === void 0 ? void 0 : _e.ghost,
|
|
94
94
|
...(_f = customTheme.variantColors) === null || _f === void 0 ? void 0 : _f.ghost,
|
|
95
95
|
},
|
|
96
|
-
glass: {
|
|
97
|
-
...(_g = badgeTheme.variantColors) === null || _g === void 0 ? void 0 : _g.glass,
|
|
98
|
-
...(_h = customTheme.variantColors) === null || _h === void 0 ? void 0 : _h.glass,
|
|
99
|
-
},
|
|
100
96
|
},
|
|
101
97
|
sizes: {
|
|
102
98
|
...badgeTheme.sizes,
|
|
@@ -132,16 +128,16 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
132
128
|
},
|
|
133
129
|
};
|
|
134
130
|
// Get styles from theme
|
|
135
|
-
const variantStyles = ((
|
|
136
|
-
const colorStyles = ((
|
|
137
|
-
const sizeStyle = ((
|
|
131
|
+
const variantStyles = ((_g = theme.variants) === null || _g === void 0 ? void 0 : _g[variant]) || "";
|
|
132
|
+
const colorStyles = ((_j = (_h = theme.variantColors) === null || _h === void 0 ? void 0 : _h[variant]) === null || _j === void 0 ? void 0 : _j[color]) || "";
|
|
133
|
+
const sizeStyle = ((_k = theme.sizes) === null || _k === void 0 ? void 0 : _k[size]) || "";
|
|
138
134
|
const shapeStyle = pill
|
|
139
135
|
? "rounded-full"
|
|
140
136
|
: "rounded-[var(--badge-rounded)]";
|
|
141
|
-
const dotColorStyle = ((
|
|
137
|
+
const dotColorStyle = ((_l = theme.dotColors) === null || _l === void 0 ? void 0 : _l[color]) || "";
|
|
142
138
|
// Build base styles with all states
|
|
143
139
|
const isInteractive = selectable || dismissible;
|
|
144
|
-
const baseStyles = cn(theme.baseStyle, shapeStyle, variantStyles, colorStyles, sizeStyle, pill && ((
|
|
140
|
+
const baseStyles = cn(theme.baseStyle, shapeStyle, variantStyles, colorStyles, sizeStyle, pill && ((_m = theme.pillSizes) === null || _m === void 0 ? void 0 : _m[size]), isInteractive && "cursor-pointer", disabled && ((_o = theme.states) === null || _o === void 0 ? void 0 : _o.disabled), darkMode && "dark", className);
|
|
145
141
|
// Create data attributes for styling hooks
|
|
146
142
|
const dataAttributes = {
|
|
147
143
|
"data-variant": variant,
|
|
@@ -198,8 +194,8 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
198
194
|
: maxWidth,
|
|
199
195
|
}
|
|
200
196
|
: undefined }, children),
|
|
201
|
-
dismissible && (React__default.createElement("button", { type: "button", onClick: handleDismiss, className: cn("badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", (
|
|
202
|
-
React__default.createElement(XMarkIcon, { className: cn("badge-dismiss-icon", (
|
|
197
|
+
dismissible && (React__default.createElement("button", { type: "button", onClick: handleDismiss, className: cn("badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", (_p = theme.dismissButtonSizes) === null || _p === void 0 ? void 0 : _p[size]), "aria-label": "Dismiss", disabled: disabled },
|
|
198
|
+
React__default.createElement(XMarkIcon, { className: cn("badge-dismiss-icon", (_q = theme.dismissIconSizes) === null || _q === void 0 ? void 0 : _q[size]), "aria-hidden": "true" }))))) : null;
|
|
203
199
|
}
|
|
204
200
|
return (React__default.createElement(AnimatePresence, { mode: "wait" }, isVisible && (React__default.createElement(motion.span, { ref: ref, className: baseStyles, onClick: handleClick, role: selectable ? "button" : undefined, tabIndex: selectable && !disabled ? 0 : undefined, "aria-pressed": selectable ? isSelected : undefined, "aria-disabled": disabled || undefined, variants: dismissible ? dismissVariants : badgeVariants, initial: "initial", animate: "animate", exit: "exit", whileTap: selectable && !disabled ? { scale: 0.98 } : undefined, ...dataAttributes, ...props },
|
|
205
201
|
renderLeftContent(),
|
|
@@ -210,8 +206,8 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
210
206
|
: maxWidth,
|
|
211
207
|
}
|
|
212
208
|
: undefined }, children),
|
|
213
|
-
dismissible && (React__default.createElement(motion.button, { type: "button", onClick: handleDismiss, className: cn("badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", (
|
|
214
|
-
React__default.createElement(XMarkIcon, { className: cn("badge-dismiss-icon", (
|
|
209
|
+
dismissible && (React__default.createElement(motion.button, { type: "button", onClick: handleDismiss, className: cn("badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", (_r = theme.dismissButtonSizes) === null || _r === void 0 ? void 0 : _r[size]), "aria-label": "Dismiss", disabled: disabled, variants: dismissButtonVariants, initial: "initial", whileHover: "hover", whileTap: "tap" },
|
|
210
|
+
React__default.createElement(XMarkIcon, { className: cn("badge-dismiss-icon", (_s = theme.dismissIconSizes) === null || _s === void 0 ? void 0 : _s[size]), "aria-hidden": "true" })))))));
|
|
215
211
|
}));
|
|
216
212
|
Badge.displayName = "Badge";
|
|
217
213
|
|
|
@@ -7,10 +7,9 @@ const badgeTheme = {
|
|
|
7
7
|
baseStyle: "inline-flex items-center font-medium select-none whitespace-nowrap transition-all duration-300 h-fit",
|
|
8
8
|
// Visual style variants (structure only, no colors)
|
|
9
9
|
variants: {
|
|
10
|
-
filled: "
|
|
10
|
+
filled: "",
|
|
11
11
|
outline: "bg-transparent border",
|
|
12
12
|
ghost: "ring-transparent border-0",
|
|
13
|
-
glass: "glass-effect !ring-1",
|
|
14
13
|
},
|
|
15
14
|
// Color styles organized PER VARIANT
|
|
16
15
|
// This structure enables reliable dark: variants and className overrides
|
|
@@ -54,23 +53,10 @@ const badgeTheme = {
|
|
|
54
53
|
danger: "bg-[var(--color-danger-50)] text-[var(--color-danger-600)] " +
|
|
55
54
|
"dark:bg-[var(--color-danger-900)]/30 dark:text-[var(--color-danger-400)]",
|
|
56
55
|
},
|
|
57
|
-
// Glass variant - glass effect with subtle styling
|
|
58
|
-
glass: {
|
|
59
|
-
neutral: "text-[var(--color-text-primary)] !ring-[var(--color-border)] bg-[var(--color-neutral-100)] " +
|
|
60
|
-
"dark:!text-[var(--color-text-primary)] ",
|
|
61
|
-
primary: "text-[var(--color-primary)] !ring-[var(--color-border)] bg-[var(--color-primary-500)] " +
|
|
62
|
-
"dark:text-[var(--color-primary-300)] ",
|
|
63
|
-
success: "text-[var(--color-success)] !ring-[var(--color-border)] " +
|
|
64
|
-
"dark:text-[var(--color-success-300)] ",
|
|
65
|
-
warning: "text-[var(--color-warning)] !ring-[var(--color-border)] " +
|
|
66
|
-
"dark:text-[var(--color-warning-200)] ",
|
|
67
|
-
danger: "text-[var(--color-danger)] !ring-[var(--color-border)] " +
|
|
68
|
-
"dark:text-[var(--color-danger-400)] ",
|
|
69
|
-
},
|
|
70
56
|
},
|
|
71
57
|
// Flat size structure (no nested objects)
|
|
72
58
|
sizes: {
|
|
73
|
-
sm: "text-xs px-
|
|
59
|
+
sm: "text-xs px-1.5 py-0.5 gap-1",
|
|
74
60
|
md: "text-sm px-2 py-0.5 gap-1",
|
|
75
61
|
lg: "text-sm px-2.5 py-1 gap-1",
|
|
76
62
|
},
|
|
@@ -106,11 +92,11 @@ const badgeTheme = {
|
|
|
106
92
|
},
|
|
107
93
|
// Dot indicator colors (simple, no dark mode needed - inherits from parent)
|
|
108
94
|
dotColors: {
|
|
109
|
-
neutral: "bg-[var(--color-text-primary)] dark:bg-[var(--color-text-inverse)]",
|
|
110
|
-
primary: "bg-[var(--color-primary-
|
|
111
|
-
success: "bg-[var(--color-success-
|
|
112
|
-
warning: "bg-[var(--color-warning-
|
|
113
|
-
danger: "bg-[var(--color-danger-
|
|
95
|
+
neutral: "bg-[var(--color-text-primary-50)] dark:bg-[var(--color-text-inverse)]",
|
|
96
|
+
primary: "bg-[var(--color-primary-50)] dark:bg-[var(--color-primary-300)]",
|
|
97
|
+
success: "bg-[var(--color-success-50)] dark:bg-[var(--color-success-300)]",
|
|
98
|
+
warning: "bg-[var(--color-warning-50)] dark:bg-[var(--color-warning-300)]",
|
|
99
|
+
danger: "bg-[var(--color-danger-50)] dark:bg-[var(--color-danger-300)]",
|
|
114
100
|
},
|
|
115
101
|
// State styles
|
|
116
102
|
states: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, MouseEvent } from "react";
|
|
2
2
|
import { HTMLMotionProps } from "motion/react";
|
|
3
|
-
export type BadgeVariant = "filled" | "outline" | "ghost"
|
|
3
|
+
export type BadgeVariant = "filled" | "outline" | "ghost";
|
|
4
4
|
export type BadgeColor = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
5
5
|
export type BadgeSize = "sm" | "md" | "lg";
|
|
6
6
|
/**
|
|
@@ -163,4 +163,12 @@ export interface BadgeProps extends Omit<HTMLMotionProps<"span">, "onSelect" | "
|
|
|
163
163
|
* Component-level theme overrides
|
|
164
164
|
*/
|
|
165
165
|
theme?: BadgeThemeOverrides;
|
|
166
|
+
/**
|
|
167
|
+
* Force dark mode styling for the component. Use when placing the component
|
|
168
|
+
* on a dark background while the page is in light mode. This applies the
|
|
169
|
+
* 'dark' class to the container, making text, borders, and other elements
|
|
170
|
+
* use light colors for visibility.
|
|
171
|
+
* @default false
|
|
172
|
+
*/
|
|
173
|
+
darkMode?: boolean;
|
|
166
174
|
}
|
|
@@ -17,7 +17,7 @@ const BUTTON_TAP_ANIMATION = {
|
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
|
-
const Button = React__default.forwardRef(({ children, className = "", iconOnly = false, state = "default", size = "md", color, variant, block = false, onClick, enableRipple = true, rippleEffect = "default", rippleClassName, rippleScale = 10, showReflection = true, ...props }, ref) => {
|
|
20
|
+
const Button = React__default.forwardRef(({ children, className = "", iconOnly = false, state = "default", size = "md", color, variant, block = false, onClick, enableRipple = true, rippleEffect = "default", rippleClassName, rippleScale = 10, showReflection = true, darkMode = false, ...props }, ref) => {
|
|
21
21
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
22
22
|
const shouldReduceMotion = useReducedMotion();
|
|
23
23
|
const shouldDisableAnimations = !!shouldReduceMotion;
|
|
@@ -109,7 +109,7 @@ const Button = React__default.forwardRef(({ children, className = "", iconOnly =
|
|
|
109
109
|
node;
|
|
110
110
|
}
|
|
111
111
|
}, [ref, buttonRef]);
|
|
112
|
-
return (React__default.createElement(motion.button, { ref: mergedRef, type: "button", className: cn(buttonTheme.baseStyle, colorClasses, variantClasses, sizeClasses, blockStyle, stateClasses, className), disabled: isDisabled, "data-state": state, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": size, "data-icon-only": iconOnly ? "true" : "false", "data-block": block ? "true" : "false", "aria-disabled": isDisabled || undefined, "aria-invalid": isError || undefined, "aria-label": ariaLabel, "aria-describedby": undefined, onClick: handleClick, ...animationProps, ...props },
|
|
112
|
+
return (React__default.createElement(motion.button, { ref: mergedRef, type: "button", className: cn(buttonTheme.baseStyle, colorClasses, variantClasses, sizeClasses, blockStyle, stateClasses, darkMode && "dark", className), disabled: isDisabled, "data-state": state, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": size, "data-icon-only": iconOnly ? "true" : "false", "data-block": block ? "true" : "false", "aria-disabled": isDisabled || undefined, "aria-invalid": isError || undefined, "aria-label": ariaLabel, "aria-describedby": undefined, onClick: handleClick, ...animationProps, ...props },
|
|
113
113
|
showReflection &&
|
|
114
114
|
resolvedVariant !== "link" &&
|
|
115
115
|
resolvedVariant !== "outline" && (React__default.createElement("div", { className: "absolute top-0.25 right-0.25 left-0.25 h-3 bg-gradient-to-b border-t-[0.5px] border-white/40 rounded-t-[calc(var(--button-rounded)-1.25px)] opacity-60" })),
|
|
@@ -137,7 +137,7 @@ const buttonTheme = {
|
|
|
137
137
|
},
|
|
138
138
|
// State styles
|
|
139
139
|
states: {
|
|
140
|
-
disabled: "opacity-50 cursor-not-allowed pointer-events-none
|
|
140
|
+
disabled: "opacity-50 cursor-not-allowed pointer-events-none saturate-0",
|
|
141
141
|
error: "ring-2 ring-[var(--color-danger-500)]",
|
|
142
142
|
loading: "cursor-not-allowed",
|
|
143
143
|
// default state has no additional classes
|
|
@@ -41,6 +41,14 @@ export interface ButtonProps extends HTMLMotionProps<"button"> {
|
|
|
41
41
|
rippleScale?: number;
|
|
42
42
|
/** Whether to show the glass reflection effect (default: true) */
|
|
43
43
|
showReflection?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Force dark mode styling for the component. Use when placing the component
|
|
46
|
+
* on a dark background while the page is in light mode. This applies the
|
|
47
|
+
* 'dark' class to the container, making text, borders, and other elements
|
|
48
|
+
* use light colors for visibility.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
darkMode?: boolean;
|
|
44
52
|
}
|
|
45
53
|
export type ButtonColor = "neutral" | "dark" | "primary" | "success" | "warning" | "danger";
|
|
46
54
|
export type ButtonVariant = "filled" | "outline" | "ghost" | "link";
|
|
@@ -7,12 +7,18 @@ import { CardDescription } from './CardDescription.js';
|
|
|
7
7
|
import { CardContent } from './CardContent.js';
|
|
8
8
|
import { CardFooter } from './CardFooter.js';
|
|
9
9
|
|
|
10
|
-
const CardRoot = React__default.forwardRef(({ children, className, theme: customTheme = {}, ...props }, ref) => {
|
|
10
|
+
const CardRoot = React__default.forwardRef(({ children, className, theme: customTheme = {}, title, description, footer, darkMode = false, ...props }, ref) => {
|
|
11
11
|
const theme = {
|
|
12
12
|
...cardTheme,
|
|
13
13
|
...customTheme,
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
const hasHeader = title || description;
|
|
16
|
+
return (React__default.createElement("div", { ref: ref, className: cn(theme.baseStyle, darkMode && "dark", className), ...props },
|
|
17
|
+
hasHeader && (React__default.createElement("div", { className: theme.headerStyle },
|
|
18
|
+
title && React__default.createElement("div", { className: theme.titleStyle }, title),
|
|
19
|
+
description && React__default.createElement("div", { className: theme.descriptionStyle }, description))),
|
|
20
|
+
hasHeader ? (React__default.createElement("div", { className: theme.contentStyle }, children)) : (children),
|
|
21
|
+
footer && React__default.createElement("div", { className: theme.footerStyle }, footer)));
|
|
16
22
|
});
|
|
17
23
|
CardRoot.displayName = 'Card';
|
|
18
24
|
// Create compound component with proper typing
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const cardTheme = {
|
|
2
|
-
baseStyle: "rounded-xl overflow-hidden bg-[var(--color-
|
|
2
|
+
baseStyle: "rounded-xl overflow-hidden bg-white border border-[var(--color-border)] shadow-xs dark:bg-[var(--color-background-secondary)]",
|
|
3
3
|
headerStyle: "flex flex-col space-y-1.5 p-4",
|
|
4
4
|
titleStyle: "text-base font-semibold leading-none text-[var(--color-text-primary)]",
|
|
5
5
|
descriptionStyle: "text-sm text-[var(--color-text-muted)]",
|
|
@@ -15,7 +15,7 @@ export interface CardThemeOverrides {
|
|
|
15
15
|
contentStyle?: string;
|
|
16
16
|
footerStyle?: string;
|
|
17
17
|
}
|
|
18
|
-
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
19
|
/**
|
|
20
20
|
* The content to be displayed inside the card
|
|
21
21
|
*/
|
|
@@ -28,6 +28,29 @@ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
28
28
|
* Component-level theme overrides
|
|
29
29
|
*/
|
|
30
30
|
theme?: CardThemeOverrides;
|
|
31
|
+
/**
|
|
32
|
+
* Card title - auto-generates header when provided
|
|
33
|
+
* Use this for simple cards instead of Card.Header/Card.Title
|
|
34
|
+
*/
|
|
35
|
+
title?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Card description - displayed below title in auto-generated header
|
|
38
|
+
* Use this for simple cards instead of Card.Header/Card.Description
|
|
39
|
+
*/
|
|
40
|
+
description?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Card footer content - auto-generates footer when provided
|
|
43
|
+
* Use this for simple cards instead of Card.Footer
|
|
44
|
+
*/
|
|
45
|
+
footer?: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Force dark mode styling for the component. Use when placing the component
|
|
48
|
+
* on a dark background while the page is in light mode. This applies the
|
|
49
|
+
* 'dark' class to the container, making text, borders, and other elements
|
|
50
|
+
* use light colors for visibility.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
darkMode?: boolean;
|
|
31
54
|
}
|
|
32
55
|
export interface CardComponent extends ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement>> {
|
|
33
56
|
Header: ForwardRefExoticComponent<CardHeaderProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { DrawerProps, DrawerContextValue } from "./Drawer.types";
|
|
3
3
|
export declare const useDrawerContext: () => DrawerContextValue;
|
|
4
4
|
export declare const Drawer: {
|
|
5
|
-
({ isOpen, onClose, position, size, closeOnOverlayClick, closeOnEsc, showCloseButton, children, className, theme: themeOverrides, ...props }: DrawerProps): React.
|
|
5
|
+
({ isOpen, onClose, position, size, closeOnOverlayClick, closeOnEsc, showCloseButton, children, className, theme: themeOverrides, ...props }: DrawerProps): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
} & {
|
|
8
8
|
Header: {
|