@sybilion/uilib 1.3.98 → 1.3.99
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/esm/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/components/ui/Chart/components/BaseChartWrapper.js +12 -10
- package/dist/esm/components/ui/Chart/components/BaseChartWrapper.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.js +19 -7
- package/dist/esm/types/src/components/ui/Chart/Chart.d.ts +2 -2
- package/dist/esm/types/src/components/ui/Chart/components/BaseChartWrapper.d.ts +7 -1
- package/dist/esm/types/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.d.ts +1 -1
- package/dist/esm/types/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.d.ts +1 -3
- package/package.json +1 -1
- package/src/components/ui/Button/Button.styl +5 -8
- package/src/components/ui/Chart/Chart.tsx +5 -1
- package/src/components/ui/Chart/components/BaseChartWrapper.styl +9 -0
- package/src/components/ui/Chart/components/BaseChartWrapper.styl.d.ts +2 -0
- package/src/components/ui/Chart/components/BaseChartWrapper.tsx +62 -14
- package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.test.tsx +17 -0
- package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.tsx +23 -7
- package/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.ts +1 -3
- package/src/docs/components/DocsSidebar/DocsSidebar.tsx +7 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Button_root__NT88y{align-items:center;border:0;border-radius:var(--radius-button);cursor:pointer;display:inline-flex;flex-shrink:0;font-family:Manrope,sans-serif;font-size:15px;font-weight:500;gap:10px;justify-content:center;line-height:1;outline:none;transition:all var(--dur-base) var(--ease-standard);white-space:nowrap}.Button_root__NT88y:disabled{opacity:.5;pointer-events:none}.Button_root__NT88y:focus-visible{border-color:var(--ring);ring:3px var(--ring-50)}.Button_root__NT88y[aria-invalid=true]{border-color:var(--destructive);ring:3px var(--destructive-200)}.Button_root__NT88y svg{flex-shrink:0;pointer-events:none}.Button_default__xZ4lt{background-color:var(--primary);color:var(--primary-foreground)}.Button_default__xZ4lt:hover{background-color:var(--sb-gray-800)}.Button_destructive__g1Ume{background-color:var(--destructive);color:#fff}.Button_destructive__g1Ume:hover{background-color:var(--destructive-
|
|
3
|
+
var css_248z = ".Button_root__NT88y{align-items:center;border:0;border-radius:var(--radius-button);cursor:pointer;display:inline-flex;flex-shrink:0;font-family:Manrope,sans-serif;font-size:15px;font-weight:500;gap:10px;justify-content:center;line-height:1;outline:none;transition:all var(--dur-base) var(--ease-standard);white-space:nowrap}.Button_root__NT88y:disabled{opacity:.5;pointer-events:none}.Button_root__NT88y:focus-visible{border-color:var(--ring);ring:3px var(--ring-50)}.Button_root__NT88y[aria-invalid=true]{border-color:var(--destructive);ring:3px var(--destructive-200)}.Button_root__NT88y svg{flex-shrink:0;pointer-events:none}.Button_default__xZ4lt{background-color:var(--primary);color:var(--primary-foreground)}.Button_default__xZ4lt:hover{background-color:var(--sb-gray-800)}.Button_destructive__g1Ume{background-color:var(--destructive-900);color:#fff}.Button_destructive__g1Ume:hover{background-color:var(--destructive-600)}.Button_destructive__g1Ume:focus-visible{ring:3px var(--destructive-200)}.dark .Button_destructive__g1Ume:focus-visible{ring:3px var(--destructive-400)}.Button_outline__E4R5l{background-color:var(--background);border:1px solid var(--border)}.Button_outline__E4R5l:hover{background-color:var(--sb-gray-50);border-color:var(--border)}.dark .Button_outline__E4R5l{background-color:var(--sb-gray-900);border-color:var(--border)}.dark .Button_outline__E4R5l:hover{background-color:var(--sb-gray-800)}.Button_secondary__ptn3U{background-color:var(--secondary);color:var(--secondary-foreground)}.Button_secondary__ptn3U:hover{background-color:var(--secondary-800)}.Button_ghost__okHgV:hover{background-color:var(--accent);color:var(--accent-foreground)}.dark .Button_ghost__okHgV:hover{background-color:var(--accent-500)}.Button_link__yHy2o{color:var(--primary);text-decoration:underline;text-underline-offset:4px}.Button_link__yHy2o:hover{text-decoration:underline}.Button_sizeSm__skgOG{border-radius:var(--p-5);font-size:13px;height:30px;padding:0 14px}.Button_sizeMd__7MeqU{border-radius:var(--p-4);height:44px;padding:0 var(--p-4)}.Button_sizeLg__Xfon-{border-radius:var(--p-4);font-size:var(--text-base);height:48px;padding:0 var(--p-6)}.Button_sizeIcon__9ef49{height:48px;padding:0;width:48px}.Button_sizeIcon__9ef49.Button_sizeSm__skgOG{height:36px;padding:0;width:36px}.Button_sizeIcon__9ef49.Button_sizeMd__7MeqU{height:48px;padding:0;width:48px}.Button_sizeIcon__9ef49.Button_sizeLg__Xfon-{height:56px;padding:0;width:56px}";
|
|
4
4
|
var S = {"root":"Button_root__NT88y","default":"Button_default__xZ4lt","destructive":"Button_destructive__g1Ume","outline":"Button_outline__E4R5l","secondary":"Button_secondary__ptn3U","ghost":"Button_ghost__okHgV","link":"Button_link__yHy2o","sizeSm":"Button_sizeSm__skgOG","sizeMd":"Button_sizeMd__7MeqU","sizeLg":"Button_sizeLg__Xfon-","sizeIcon":"Button_sizeIcon__9ef49"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@ import { formatDate } from '../tools/formatters.js';
|
|
|
11
11
|
import S from './BaseChartWrapper.styl.js';
|
|
12
12
|
import { ChartAxes } from './ChartAxes.js';
|
|
13
13
|
import { ChartContainer } from './ChartContainer.js';
|
|
14
|
+
import { ChartEmptyState } from './ChartEmptyState/ChartEmptyState.js';
|
|
14
15
|
import { ChartGrid } from './ChartGrid.js';
|
|
15
16
|
import { ChartTooltipContent } from './ChartTooltipContent.js';
|
|
16
17
|
import { CustomChartLegend } from './CustomChartLegend/CustomChartLegend.js';
|
|
@@ -40,8 +41,8 @@ function clampTooltipTranslate(args) {
|
|
|
40
41
|
* Simple loading component without hooks for better performance
|
|
41
42
|
* Rendered when chart is waiting in render queue
|
|
42
43
|
*/
|
|
43
|
-
const BaseChartWrapperLoading = forwardRef(({ className, height, loadingMessage }, ref) => {
|
|
44
|
-
return (jsx("div", { ref: ref, className: cn(S.root, className), children: jsx("div", { className: S.chartLoadingContainer, style: height ? { height: `${height}px` } : undefined, children: loadingMessage || (jsx("div", { className: S.loadingOverlay, children: jsx(Skeleton, { style: { width: '100%', height: '100%' } }) })) }) }));
|
|
44
|
+
const BaseChartWrapperLoading = forwardRef(({ className, loadingComponentClassName, height, loadingMessage }, ref) => {
|
|
45
|
+
return (jsx("div", { ref: ref, className: cn(S.root, className), children: jsx("div", { className: S.chartLoadingContainer, style: height ? { height: `${height}px` } : undefined, children: jsx("div", { "data-slot": "chart", className: S.loadingChartSlot, children: loadingMessage || (jsx("div", { className: cn(S.loadingOverlay, loadingComponentClassName), children: jsx(Skeleton, { style: { width: '100%', height: '100%' } }) })) }) }) }));
|
|
45
46
|
});
|
|
46
47
|
BaseChartWrapperLoading.displayName = 'BaseChartWrapperLoading';
|
|
47
48
|
/**
|
|
@@ -49,7 +50,7 @@ BaseChartWrapperLoading.displayName = 'BaseChartWrapperLoading';
|
|
|
49
50
|
* Separated to maintain hook order consistency
|
|
50
51
|
*/
|
|
51
52
|
const BaseChartWrapperContent = forwardRef((props, ref) => {
|
|
52
|
-
const { chartConfig = {}, chartData, historicalLineColor, forecastData = [], loading, hasCombinedData, renderId, isDarkTheme, height, className, loadingComponentClassName, footerClassName, chartClassName, xAxisClassName, yAxisClassName, legendClassName, footerActions, quantileBands, quantileBandKey, xMin, xMax, yMin, yMax, autoScaleYAxis = true, formatNumber, formatDate: formatDateFn = formatDate, labelFormatter, onLegendClick, margin, chartType = 'composed', disableAnimation = false, disableLineDrawAnimation = false, showGrid = true, showAxes = true, showTooltip = true, showLegend = true, showChartAxesLegend = true, xAxisLabel, yAxisLabel, showActiveDots = true, overlayElements, hiddenSeries, includeHiddenInYScale = false, excludeLegendIds, onAnalysisSelect, onFailedAnalysisClick, containerProps, error, loadingMessage, noDataMessage = 'No data available', onGridHeightChange, forecastLineStyle = 'dashed', disableHistoricalAnimation = false, onShowAll: _onShowAll, onShowOnly: _onShowOnly, maxVisibleItems, preventDeselection, legendVariant = 'default', legendWidth = 1000, legendMarginLeft = 0, } = props;
|
|
53
|
+
const { chartConfig = {}, chartData, historicalLineColor, forecastData = [], loading, hasCombinedData, renderId, isDarkTheme, height, className, loadingComponentClassName, footerClassName, chartClassName, xAxisClassName, yAxisClassName, legendClassName, footerActions, quantileBands, quantileBandKey, xMin, xMax, yMin, yMax, autoScaleYAxis = true, formatNumber, formatDate: formatDateFn = formatDate, labelFormatter, onLegendClick, margin, chartType = 'composed', disableAnimation = false, disableLineDrawAnimation = false, showGrid = true, showAxes = true, showTooltip = true, showLegend = true, showChartAxesLegend = true, xAxisLabel, yAxisLabel, showActiveDots = true, overlayElements, hiddenSeries, includeHiddenInYScale = false, excludeLegendIds, onAnalysisSelect, onFailedAnalysisClick, containerProps, error, loadingMessage, noDataHint, noDataMessage = 'No data available', noDataStatusTone = 'muted', suppressNoDataState = false, onGridHeightChange, forecastLineStyle = 'dashed', disableHistoricalAnimation = false, onShowAll: _onShowAll, onShowOnly: _onShowOnly, maxVisibleItems, preventDeselection, legendVariant = 'default', legendWidth = 1000, legendMarginLeft = 0, } = props;
|
|
53
54
|
const [shouldAnimate, setShouldAnimate] = useState(false);
|
|
54
55
|
const lineDataInitializedRef = useRef(false);
|
|
55
56
|
const rootRef = useRef(null);
|
|
@@ -276,15 +277,16 @@ const BaseChartWrapperContent = forwardRef((props, ref) => {
|
|
|
276
277
|
if (!chartData.length) {
|
|
277
278
|
// If hasCombinedData is true but chartData is empty, data is being processed - wait instead of showing "No data"
|
|
278
279
|
if (hasCombinedData) {
|
|
279
|
-
|
|
280
|
-
return jsx("div", { className: cn(S.root, className) });
|
|
280
|
+
return (jsx("div", { className: cn(S.root, className), children: jsx("div", { className: S.emptyChartSizer, style: height ? { minHeight: height } : undefined, "aria-hidden": true }) }));
|
|
281
281
|
}
|
|
282
282
|
// If renderId is undefined/null, we're still initializing - wait instead of showing "No data"
|
|
283
283
|
if (!renderId) {
|
|
284
|
-
|
|
285
|
-
return jsx("div", { className: cn(S.root, className) });
|
|
284
|
+
return (jsx("div", { className: cn(S.root, className), children: jsx("div", { className: S.emptyChartSizer, style: height ? { minHeight: height } : undefined, "aria-hidden": true }) }));
|
|
286
285
|
}
|
|
287
|
-
|
|
286
|
+
if (suppressNoDataState) {
|
|
287
|
+
return (jsx("div", { className: cn(S.root, className), children: jsx("div", { className: S.emptyChartSizer, style: height ? { minHeight: height } : undefined, "aria-hidden": true }) }));
|
|
288
|
+
}
|
|
289
|
+
return (jsx("div", { className: cn(S.root, className), children: jsx(ChartEmptyState, { variant: "panel", align: "center", hint: noDataHint, status: noDataMessage, statusTone: noDataStatusTone }) }));
|
|
288
290
|
}
|
|
289
291
|
// Smart auto-scaling: detect when explicit bounds are too wide
|
|
290
292
|
// Only apply smart auto-scaling if autoScaleYAxis is not explicitly set to false
|
|
@@ -396,11 +398,11 @@ function BaseChartWrapper(props) {
|
|
|
396
398
|
}, [renderId, chartData.length, loading, hasCombinedData, legendVariant]);
|
|
397
399
|
// Show loading skeleton when datasets list is loading (after all hooks are called)
|
|
398
400
|
if (loading) {
|
|
399
|
-
return (jsx(BaseChartWrapperLoading, { ref: containerRef, className:
|
|
401
|
+
return (jsx(BaseChartWrapperLoading, { ref: containerRef, className: props.className, loadingComponentClassName: props.loadingComponentClassName, height: props.height, loadingMessage: props.loadingMessage }));
|
|
400
402
|
}
|
|
401
403
|
// If not ready to render, show loading component (no hooks initialized)
|
|
402
404
|
if (!isReadyToRender) {
|
|
403
|
-
return (jsx(BaseChartWrapperLoading, { ref: containerRef, className:
|
|
405
|
+
return (jsx(BaseChartWrapperLoading, { ref: containerRef, className: props.className, loadingComponentClassName: props.loadingComponentClassName, height: props.height, loadingMessage: props.loadingMessage }));
|
|
404
406
|
}
|
|
405
407
|
// Render chart content with all hooks
|
|
406
408
|
return jsx(BaseChartWrapperContent, { ref: containerRef, ...props });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".BaseChartWrapper_chartContainer__J6CIc,.BaseChartWrapper_root__hhfho{min-height:100%}.BaseChartWrapper_root__hhfho{position:relative;width:100%}.BaseChartWrapper_gridLayer__cwJXA{pointer-events:none;position:absolute;z-index:1}.BaseChartWrapper_gridLayer__cwJXA .recharts-cartesian-axis{pointer-events:auto;z-index:1}.BaseChartWrapper_chartLayer__HmBaJ{inset:0;pointer-events:auto;position:relative;z-index:3}.BaseChartWrapper_chartLayer__HmBaJ .recharts-surface{background:transparent}.BaseChartWrapper_chartLayer__HmBaJ .recharts-layer{pointer-events:none}.BaseChartWrapper_chartLayer__HmBaJ .recharts-tooltip-wrapper{visibility:visible!important}.BaseChartWrapper_invisibleAxis__TQ-Zk .recharts-cartesian-axis-tick{visibility:hidden}.BaseChartWrapper_legend__gkSy1{position:absolute;top:100%;width:100%}.BaseChartWrapper_noLegend__jqaPa{display:block}.BaseChartWrapper_hideChartAxesLegend__dgVx- .recharts-cartesian-axis-tick-label{display:none!important}.BaseChartWrapper_chartLoadingContainer__AJP-0{align-items:center;display:flex;height:var(--chart-height);justify-content:center;width:100%}.BaseChartWrapper_loadingOverlay__GcOkA{height:100%;inset:0;opacity:.5;pointer-events:none;position:absolute;transition:opacity .1s ease-out;width:100%;z-index:10}.BaseChartWrapper_loadingOverlay__GcOkA [data-slot=skeleton]{border-radius:var(--p-4)!important}.BaseChartWrapper_loaded__Gj15C .BaseChartWrapper_loadingOverlay__GcOkA{opacity:0}.BaseChartWrapper_errorContainer__1bXy1{align-items:center;color:var(--destructive);display:flex;justify-content:center;min-height:250px}.BaseChartWrapper_errorMessage__veSmB{color:var(--destructive)}.BaseChartWrapper_noLineDrawAnimation__cyrzV .recharts-line-curve{stroke-dasharray:inherit!important}.BaseChartWrapper_footer__nP5u6{align-items:center;display:flex;gap:var(--p-2);justify-content:space-between}";
|
|
4
|
-
var S = {"root":"BaseChartWrapper_root__hhfho","chartContainer":"BaseChartWrapper_chartContainer__J6CIc","gridLayer":"BaseChartWrapper_gridLayer__cwJXA","chartLayer":"BaseChartWrapper_chartLayer__HmBaJ","invisibleAxis":"BaseChartWrapper_invisibleAxis__TQ-Zk","legend":"BaseChartWrapper_legend__gkSy1","noLegend":"BaseChartWrapper_noLegend__jqaPa","hideChartAxesLegend":"BaseChartWrapper_hideChartAxesLegend__dgVx-","chartLoadingContainer":"BaseChartWrapper_chartLoadingContainer__AJP-0","loadingOverlay":"BaseChartWrapper_loadingOverlay__GcOkA","loaded":"BaseChartWrapper_loaded__Gj15C","errorContainer":"BaseChartWrapper_errorContainer__1bXy1","errorMessage":"BaseChartWrapper_errorMessage__veSmB","noLineDrawAnimation":"BaseChartWrapper_noLineDrawAnimation__cyrzV","footer":"BaseChartWrapper_footer__nP5u6"};
|
|
3
|
+
var css_248z = ".BaseChartWrapper_chartContainer__J6CIc,.BaseChartWrapper_root__hhfho{min-height:100%}.BaseChartWrapper_root__hhfho{position:relative;width:100%}.BaseChartWrapper_gridLayer__cwJXA{pointer-events:none;position:absolute;z-index:1}.BaseChartWrapper_gridLayer__cwJXA .recharts-cartesian-axis{pointer-events:auto;z-index:1}.BaseChartWrapper_chartLayer__HmBaJ{inset:0;pointer-events:auto;position:relative;z-index:3}.BaseChartWrapper_chartLayer__HmBaJ .recharts-surface{background:transparent}.BaseChartWrapper_chartLayer__HmBaJ .recharts-layer{pointer-events:none}.BaseChartWrapper_chartLayer__HmBaJ .recharts-tooltip-wrapper{visibility:visible!important}.BaseChartWrapper_invisibleAxis__TQ-Zk .recharts-cartesian-axis-tick{visibility:hidden}.BaseChartWrapper_legend__gkSy1{position:absolute;top:100%;width:100%}.BaseChartWrapper_noLegend__jqaPa{display:block}.BaseChartWrapper_hideChartAxesLegend__dgVx- .recharts-cartesian-axis-tick-label{display:none!important}.BaseChartWrapper_chartLoadingContainer__AJP-0{align-items:center;display:flex;height:var(--chart-height);justify-content:center;width:100%}.BaseChartWrapper_loadingChartSlot__eG2BL{height:100%;position:relative;width:100%}.BaseChartWrapper_loadingOverlay__GcOkA{height:100%;inset:0;opacity:.5;pointer-events:none;position:absolute;transition:opacity .1s ease-out;width:100%;z-index:10}.BaseChartWrapper_loadingOverlay__GcOkA [data-slot=skeleton]{border-radius:var(--p-4)!important}.BaseChartWrapper_loaded__Gj15C .BaseChartWrapper_loadingOverlay__GcOkA{opacity:0}.BaseChartWrapper_errorContainer__1bXy1{align-items:center;color:var(--destructive);display:flex;justify-content:center;min-height:250px}.BaseChartWrapper_emptyChartSizer__Wg--C{min-height:var(--chart-height);width:100%}.BaseChartWrapper_errorMessage__veSmB{color:var(--destructive)}.BaseChartWrapper_noLineDrawAnimation__cyrzV .recharts-line-curve{stroke-dasharray:inherit!important}.BaseChartWrapper_footer__nP5u6{align-items:center;display:flex;gap:var(--p-2);justify-content:space-between}";
|
|
4
|
+
var S = {"root":"BaseChartWrapper_root__hhfho","chartContainer":"BaseChartWrapper_chartContainer__J6CIc","gridLayer":"BaseChartWrapper_gridLayer__cwJXA","chartLayer":"BaseChartWrapper_chartLayer__HmBaJ","invisibleAxis":"BaseChartWrapper_invisibleAxis__TQ-Zk","legend":"BaseChartWrapper_legend__gkSy1","noLegend":"BaseChartWrapper_noLegend__jqaPa","hideChartAxesLegend":"BaseChartWrapper_hideChartAxesLegend__dgVx-","chartLoadingContainer":"BaseChartWrapper_chartLoadingContainer__AJP-0","loadingChartSlot":"BaseChartWrapper_loadingChartSlot__eG2BL","loadingOverlay":"BaseChartWrapper_loadingOverlay__GcOkA","loaded":"BaseChartWrapper_loaded__Gj15C","errorContainer":"BaseChartWrapper_errorContainer__1bXy1","emptyChartSizer":"BaseChartWrapper_emptyChartSizer__Wg--C","errorMessage":"BaseChartWrapper_errorMessage__veSmB","noLineDrawAnimation":"BaseChartWrapper_noLineDrawAnimation__cyrzV","footer":"BaseChartWrapper_footer__nP5u6"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -37,18 +37,30 @@ const injectBold = (content) => {
|
|
|
37
37
|
length: matches[0].length,
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
/** `_italic_`
|
|
40
|
+
/** `*italic*` or `_italic_` — single `*` only (not `**` or `* ` bullets). */
|
|
41
41
|
const injectItalic = (content) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const patterns = [
|
|
43
|
+
/(?<![*\\])\*(?!\*)([^*\n]+?)\*(?!\*)/,
|
|
44
|
+
/(?<![A-Za-z0-9])_([^_\n]+?)_(?![A-Za-z0-9])/,
|
|
45
|
+
];
|
|
46
|
+
let match = null;
|
|
47
|
+
for (const pattern of patterns) {
|
|
48
|
+
const candidate = content.match(pattern);
|
|
49
|
+
if (candidate &&
|
|
50
|
+
candidate.index !== undefined &&
|
|
51
|
+
(match === null || candidate.index < match.index)) {
|
|
52
|
+
match = candidate;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!match || match.index === undefined)
|
|
44
56
|
return null;
|
|
45
|
-
if (isInsideHtmlListOrTable(content,
|
|
57
|
+
if (isInsideHtmlListOrTable(content, match.index)) {
|
|
46
58
|
return null;
|
|
47
59
|
}
|
|
48
60
|
return {
|
|
49
|
-
elem: jsx("em", { children:
|
|
50
|
-
index:
|
|
51
|
-
length:
|
|
61
|
+
elem: jsx("em", { children: match[1] }),
|
|
62
|
+
index: match.index,
|
|
63
|
+
length: match[0].length,
|
|
52
64
|
};
|
|
53
65
|
};
|
|
54
66
|
const injectBullet = (content) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as RechartsPrimitive from 'recharts';
|
|
2
|
-
import { BaseChartWrapper } from './components/BaseChartWrapper';
|
|
2
|
+
import { BaseChartWrapper, type BaseChartWrapperProps } from './components/BaseChartWrapper';
|
|
3
3
|
import { ChartContainer, ChartStyle } from './components/ChartContainer';
|
|
4
4
|
import { ChartLegendContent } from './components/ChartLegendContent';
|
|
5
5
|
import { ChartTooltipContent } from './components/ChartTooltipContent';
|
|
@@ -9,6 +9,6 @@ export * from './Chart.types';
|
|
|
9
9
|
export { ChartTooltipItem } from './components/ChartTooltipItem';
|
|
10
10
|
export { ChartLegendItem } from './components/ChartLegendItem';
|
|
11
11
|
export { CustomChartLegend } from './components/CustomChartLegend/CustomChartLegend';
|
|
12
|
-
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, BaseChartWrapper, };
|
|
12
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, BaseChartWrapper, type BaseChartWrapperProps, };
|
|
13
13
|
export { LightweightForecastChart, type LightweightForecastChartProps, } from './lightweight/LightweightForecastChart';
|
|
14
14
|
export { ChartEmptyState, type ChartEmptyStateProps, type ChartEmptyStatusTone, } from './components/ChartEmptyState/ChartEmptyState';
|
|
@@ -5,6 +5,7 @@ import { ForecastItemData } from '#uilib/components/ui/ChartAreaInteractive/Char
|
|
|
5
5
|
import { LegendPayload } from 'recharts/types/component/DefaultLegendContent';
|
|
6
6
|
import type { ChartConfig } from '../Chart.types';
|
|
7
7
|
import { ChartContainer } from './ChartContainer';
|
|
8
|
+
import { type ChartEmptyStatusTone } from './ChartEmptyState/ChartEmptyState';
|
|
8
9
|
export interface BaseChartWrapperProps {
|
|
9
10
|
renderId?: string;
|
|
10
11
|
chartConfig?: ChartConfig;
|
|
@@ -71,7 +72,12 @@ export interface BaseChartWrapperProps {
|
|
|
71
72
|
containerProps?: Omit<ComponentProps<typeof ChartContainer>, 'config' | 'className' | 'children'>;
|
|
72
73
|
error?: string | null;
|
|
73
74
|
loadingMessage?: ReactNode;
|
|
74
|
-
noDataMessage
|
|
75
|
+
/** Shown above `noDataMessage` when the chart has no series (muted). */
|
|
76
|
+
noDataHint?: ReactNode;
|
|
77
|
+
noDataMessage?: ReactNode;
|
|
78
|
+
noDataStatusTone?: ChartEmptyStatusTone;
|
|
79
|
+
/** When true, no placeholder UI for empty `chartData` (parent renders overlay). */
|
|
80
|
+
suppressNoDataState?: boolean;
|
|
75
81
|
onGridHeightChange?: (height: number) => void;
|
|
76
82
|
forecastLineStyle?: 'dashed' | 'solid';
|
|
77
83
|
disableHistoricalAnimation?: boolean;
|
|
@@ -4,7 +4,7 @@ declare const injectBold: (content: string) => {
|
|
|
4
4
|
index: number;
|
|
5
5
|
length: number;
|
|
6
6
|
};
|
|
7
|
-
/** `_italic_`
|
|
7
|
+
/** `*italic*` or `_italic_` — single `*` only (not `**` or `* ` bullets). */
|
|
8
8
|
declare const injectItalic: (content: string) => {
|
|
9
9
|
elem: import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
index: number;
|
package/package.json
CHANGED
|
@@ -44,19 +44,16 @@
|
|
|
44
44
|
background-color var(--sb-gray-800)
|
|
45
45
|
|
|
46
46
|
.destructive
|
|
47
|
-
background-color var(--destructive)
|
|
47
|
+
background-color var(--destructive-900)
|
|
48
48
|
color white
|
|
49
49
|
|
|
50
50
|
&:hover
|
|
51
|
-
background-color var(--destructive-
|
|
51
|
+
background-color var(--destructive-600)
|
|
52
52
|
|
|
53
53
|
&:focus-visible
|
|
54
|
-
ring 3px var(--destructive-200)
|
|
55
|
-
|
|
56
|
-
:global(.dark) &
|
|
57
|
-
background-color var(--destructive-600)
|
|
54
|
+
ring 3px var(--destructive-200)
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
:global(.dark) &
|
|
60
57
|
ring 3px var(--destructive-400)
|
|
61
58
|
|
|
62
59
|
.outline
|
|
@@ -107,7 +104,7 @@
|
|
|
107
104
|
|
|
108
105
|
.sizeMd
|
|
109
106
|
height 44px
|
|
110
|
-
padding
|
|
107
|
+
padding 0 var(--p-4)
|
|
111
108
|
border-radius var(--p-4)
|
|
112
109
|
|
|
113
110
|
.sizeLg
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as RechartsPrimitive from 'recharts';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BaseChartWrapper,
|
|
5
|
+
type BaseChartWrapperProps,
|
|
6
|
+
} from './components/BaseChartWrapper';
|
|
4
7
|
import { ChartContainer, ChartStyle } from './components/ChartContainer';
|
|
5
8
|
import { ChartLegendContent } from './components/ChartLegendContent';
|
|
6
9
|
import { ChartTooltipContent } from './components/ChartTooltipContent';
|
|
@@ -20,6 +23,7 @@ export {
|
|
|
20
23
|
ChartLegendContent,
|
|
21
24
|
ChartStyle,
|
|
22
25
|
BaseChartWrapper,
|
|
26
|
+
type BaseChartWrapperProps,
|
|
23
27
|
};
|
|
24
28
|
export {
|
|
25
29
|
LightweightForecastChart,
|
|
@@ -62,6 +62,11 @@
|
|
|
62
62
|
align-items center
|
|
63
63
|
justify-content center
|
|
64
64
|
|
|
65
|
+
.loadingChartSlot
|
|
66
|
+
position relative
|
|
67
|
+
width 100%
|
|
68
|
+
height 100%
|
|
69
|
+
|
|
65
70
|
.loadingOverlay
|
|
66
71
|
position absolute
|
|
67
72
|
inset 0
|
|
@@ -86,6 +91,10 @@
|
|
|
86
91
|
min-height 250px
|
|
87
92
|
color var(--destructive)
|
|
88
93
|
|
|
94
|
+
.emptyChartSizer
|
|
95
|
+
width 100%
|
|
96
|
+
min-height var(--chart-height)
|
|
97
|
+
|
|
89
98
|
.errorMessage
|
|
90
99
|
color var(--destructive)
|
|
91
100
|
|
|
@@ -4,6 +4,7 @@ interface CssExports {
|
|
|
4
4
|
'chartContainer': string;
|
|
5
5
|
'chartLayer': string;
|
|
6
6
|
'chartLoadingContainer': string;
|
|
7
|
+
'emptyChartSizer': string;
|
|
7
8
|
'errorContainer': string;
|
|
8
9
|
'errorMessage': string;
|
|
9
10
|
'footer': string;
|
|
@@ -12,6 +13,7 @@ interface CssExports {
|
|
|
12
13
|
'invisibleAxis': string;
|
|
13
14
|
'legend': string;
|
|
14
15
|
'loaded': string;
|
|
16
|
+
'loadingChartSlot': string;
|
|
15
17
|
'loadingOverlay': string;
|
|
16
18
|
'noLegend': string;
|
|
17
19
|
'noLineDrawAnimation': string;
|
|
@@ -28,6 +28,10 @@ import { formatDate } from '../tools/formatters';
|
|
|
28
28
|
import S from './BaseChartWrapper.styl';
|
|
29
29
|
import { ChartAxes } from './ChartAxes';
|
|
30
30
|
import { ChartContainer } from './ChartContainer';
|
|
31
|
+
import {
|
|
32
|
+
ChartEmptyState,
|
|
33
|
+
type ChartEmptyStatusTone,
|
|
34
|
+
} from './ChartEmptyState/ChartEmptyState';
|
|
31
35
|
import { ChartGrid } from './ChartGrid';
|
|
32
36
|
import { ChartTooltipContent } from './ChartTooltipContent';
|
|
33
37
|
import { CustomChartLegend } from './CustomChartLegend/CustomChartLegend';
|
|
@@ -138,7 +142,12 @@ export interface BaseChartWrapperProps {
|
|
|
138
142
|
>;
|
|
139
143
|
error?: string | null;
|
|
140
144
|
loadingMessage?: ReactNode;
|
|
141
|
-
noDataMessage
|
|
145
|
+
/** Shown above `noDataMessage` when the chart has no series (muted). */
|
|
146
|
+
noDataHint?: ReactNode;
|
|
147
|
+
noDataMessage?: ReactNode;
|
|
148
|
+
noDataStatusTone?: ChartEmptyStatusTone;
|
|
149
|
+
/** When true, no placeholder UI for empty `chartData` (parent renders overlay). */
|
|
150
|
+
suppressNoDataState?: boolean;
|
|
142
151
|
onGridHeightChange?: (height: number) => void;
|
|
143
152
|
forecastLineStyle?: 'dashed' | 'solid';
|
|
144
153
|
disableHistoricalAnimation?: boolean;
|
|
@@ -156,21 +165,24 @@ const BaseChartWrapperLoading = forwardRef<
|
|
|
156
165
|
HTMLDivElement,
|
|
157
166
|
{
|
|
158
167
|
className?: string;
|
|
168
|
+
loadingComponentClassName?: string;
|
|
159
169
|
height?: number;
|
|
160
170
|
loadingMessage?: ReactNode;
|
|
161
171
|
}
|
|
162
|
-
>(({ className, height, loadingMessage }, ref) => {
|
|
172
|
+
>(({ className, loadingComponentClassName, height, loadingMessage }, ref) => {
|
|
163
173
|
return (
|
|
164
174
|
<div ref={ref} className={cn(S.root, className)}>
|
|
165
175
|
<div
|
|
166
176
|
className={S.chartLoadingContainer}
|
|
167
177
|
style={height ? { height: `${height}px` } : undefined}
|
|
168
178
|
>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
<div data-slot="chart" className={S.loadingChartSlot}>
|
|
180
|
+
{loadingMessage || (
|
|
181
|
+
<div className={cn(S.loadingOverlay, loadingComponentClassName)}>
|
|
182
|
+
<Skeleton style={{ width: '100%', height: '100%' }} />
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</div>
|
|
174
186
|
</div>
|
|
175
187
|
</div>
|
|
176
188
|
);
|
|
@@ -235,7 +247,10 @@ const BaseChartWrapperContent = forwardRef<
|
|
|
235
247
|
containerProps,
|
|
236
248
|
error,
|
|
237
249
|
loadingMessage,
|
|
250
|
+
noDataHint,
|
|
238
251
|
noDataMessage = 'No data available',
|
|
252
|
+
noDataStatusTone = 'muted',
|
|
253
|
+
suppressNoDataState = false,
|
|
239
254
|
onGridHeightChange,
|
|
240
255
|
forecastLineStyle = 'dashed',
|
|
241
256
|
disableHistoricalAnimation = false,
|
|
@@ -547,17 +562,48 @@ const BaseChartWrapperContent = forwardRef<
|
|
|
547
562
|
if (!chartData.length) {
|
|
548
563
|
// If hasCombinedData is true but chartData is empty, data is being processed - wait instead of showing "No data"
|
|
549
564
|
if (hasCombinedData) {
|
|
550
|
-
|
|
551
|
-
|
|
565
|
+
return (
|
|
566
|
+
<div className={cn(S.root, className)}>
|
|
567
|
+
<div
|
|
568
|
+
className={S.emptyChartSizer}
|
|
569
|
+
style={height ? { minHeight: height } : undefined}
|
|
570
|
+
aria-hidden
|
|
571
|
+
/>
|
|
572
|
+
</div>
|
|
573
|
+
);
|
|
552
574
|
}
|
|
553
575
|
// If renderId is undefined/null, we're still initializing - wait instead of showing "No data"
|
|
554
576
|
if (!renderId) {
|
|
555
|
-
|
|
556
|
-
|
|
577
|
+
return (
|
|
578
|
+
<div className={cn(S.root, className)}>
|
|
579
|
+
<div
|
|
580
|
+
className={S.emptyChartSizer}
|
|
581
|
+
style={height ? { minHeight: height } : undefined}
|
|
582
|
+
aria-hidden
|
|
583
|
+
/>
|
|
584
|
+
</div>
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
if (suppressNoDataState) {
|
|
588
|
+
return (
|
|
589
|
+
<div className={cn(S.root, className)}>
|
|
590
|
+
<div
|
|
591
|
+
className={S.emptyChartSizer}
|
|
592
|
+
style={height ? { minHeight: height } : undefined}
|
|
593
|
+
aria-hidden
|
|
594
|
+
/>
|
|
595
|
+
</div>
|
|
596
|
+
);
|
|
557
597
|
}
|
|
558
598
|
return (
|
|
559
599
|
<div className={cn(S.root, className)}>
|
|
560
|
-
<
|
|
600
|
+
<ChartEmptyState
|
|
601
|
+
variant="panel"
|
|
602
|
+
align="center"
|
|
603
|
+
hint={noDataHint}
|
|
604
|
+
status={noDataMessage}
|
|
605
|
+
statusTone={noDataStatusTone}
|
|
606
|
+
/>
|
|
561
607
|
</div>
|
|
562
608
|
);
|
|
563
609
|
}
|
|
@@ -837,7 +883,8 @@ export function BaseChartWrapper(props: BaseChartWrapperProps) {
|
|
|
837
883
|
return (
|
|
838
884
|
<BaseChartWrapperLoading
|
|
839
885
|
ref={containerRef}
|
|
840
|
-
className={
|
|
886
|
+
className={props.className}
|
|
887
|
+
loadingComponentClassName={props.loadingComponentClassName}
|
|
841
888
|
height={props.height}
|
|
842
889
|
loadingMessage={props.loadingMessage}
|
|
843
890
|
/>
|
|
@@ -849,7 +896,8 @@ export function BaseChartWrapper(props: BaseChartWrapperProps) {
|
|
|
849
896
|
return (
|
|
850
897
|
<BaseChartWrapperLoading
|
|
851
898
|
ref={containerRef}
|
|
852
|
-
className={
|
|
899
|
+
className={props.className}
|
|
900
|
+
loadingComponentClassName={props.loadingComponentClassName}
|
|
853
901
|
height={props.height}
|
|
854
902
|
loadingMessage={props.loadingMessage}
|
|
855
903
|
/>
|
|
@@ -7,6 +7,23 @@ function renderFormatting(text: string) {
|
|
|
7
7
|
return render(<>{parts}</>);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
describe('applyFormatting emphasis', () => {
|
|
11
|
+
it('renders asterisk italic and bold in the same line', () => {
|
|
12
|
+
const { container } = renderFormatting(
|
|
13
|
+
'Use **bold** and *italic* in formatted text.',
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(container.querySelector('strong')?.textContent).toBe('bold');
|
|
17
|
+
expect(container.querySelector('em')?.textContent).toBe('italic');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders underscore italic', () => {
|
|
21
|
+
const { container } = renderFormatting('Use _italic_ emphasis.');
|
|
22
|
+
|
|
23
|
+
expect(container.querySelector('em')?.textContent).toBe('italic');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
10
27
|
describe('applyFormatting headers', () => {
|
|
11
28
|
it('renders bold inside markdown headers', () => {
|
|
12
29
|
const { container } = renderFormatting(
|
|
@@ -56,20 +56,36 @@ const injectBold = (content: string) => {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
/** `_italic_`
|
|
59
|
+
/** `*italic*` or `_italic_` — single `*` only (not `**` or `* ` bullets). */
|
|
60
60
|
const injectItalic = (content: string) => {
|
|
61
|
-
const
|
|
61
|
+
const patterns = [
|
|
62
|
+
/(?<![*\\])\*(?!\*)([^*\n]+?)\*(?!\*)/,
|
|
63
|
+
/(?<![A-Za-z0-9])_([^_\n]+?)_(?![A-Za-z0-9])/,
|
|
64
|
+
];
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
let match: RegExpMatchArray | null = null;
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
const candidate = content.match(pattern);
|
|
70
|
+
if (
|
|
71
|
+
candidate &&
|
|
72
|
+
candidate.index !== undefined &&
|
|
73
|
+
(match === null || candidate.index < match.index!)
|
|
74
|
+
) {
|
|
75
|
+
match = candidate;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!match || match.index === undefined) return null;
|
|
80
|
+
|
|
81
|
+
if (isInsideHtmlListOrTable(content, match.index)) {
|
|
66
82
|
return null;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
return {
|
|
70
|
-
elem: <em>{
|
|
71
|
-
index:
|
|
72
|
-
length:
|
|
86
|
+
elem: <em>{match[1]}</em>,
|
|
87
|
+
index: match.index,
|
|
88
|
+
length: match[0].length,
|
|
73
89
|
};
|
|
74
90
|
};
|
|
75
91
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SidebarMenuSubButton,
|
|
14
14
|
SidebarMenuSubItem,
|
|
15
15
|
} from '#uilib/components/ui/Sidebar/Sidebar';
|
|
16
|
+
import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate';
|
|
16
17
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
17
18
|
|
|
18
19
|
import { DOC_REGISTRY, DOC_SECTION_ORDER } from '../../registry';
|
|
@@ -134,7 +135,9 @@ export function DocsSidebar() {
|
|
|
134
135
|
}}
|
|
135
136
|
isActive={sectionHasActive}
|
|
136
137
|
>
|
|
137
|
-
<span>
|
|
138
|
+
<span>
|
|
139
|
+
<SmartTextTruncate>{section}</SmartTextTruncate>
|
|
140
|
+
</span>
|
|
138
141
|
{isFiltering ? null : renderSectionChevron(isExpanded)}
|
|
139
142
|
</SidebarMenuButton>
|
|
140
143
|
{isExpanded ? (
|
|
@@ -149,7 +152,9 @@ export function DocsSidebar() {
|
|
|
149
152
|
isActive={isActive}
|
|
150
153
|
size="md"
|
|
151
154
|
>
|
|
152
|
-
<Link to={to}>
|
|
155
|
+
<Link to={to}>
|
|
156
|
+
<SmartTextTruncate>{e.title}</SmartTextTruncate>
|
|
157
|
+
</Link>
|
|
153
158
|
</SidebarMenuSubButton>
|
|
154
159
|
</SidebarMenuSubItem>
|
|
155
160
|
);
|