@sybilion/uilib 1.3.98 → 1.3.100

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.
Files changed (61) hide show
  1. package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.js +61 -14
  2. package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.styl.js +2 -2
  3. package/dist/esm/components/ui/AnalysesSelector/SelectInlineRenamer.js +102 -0
  4. package/dist/esm/components/ui/Button/Button.styl.js +1 -1
  5. package/dist/esm/components/ui/Chart/Chart.js +9 -5
  6. package/dist/esm/components/ui/Chart/chartForecastVisualization.constants.js +23 -0
  7. package/dist/esm/components/ui/Chart/components/BaseChartWrapper.js +12 -10
  8. package/dist/esm/components/ui/Chart/components/BaseChartWrapper.styl.js +2 -2
  9. package/dist/esm/components/ui/Chart/components/ConfidenceBands.js +9 -0
  10. package/dist/esm/components/ui/Chart/components/CustomChartLegend/CustomChartLegend.js +2 -2
  11. package/dist/esm/components/ui/Chart/components/ForecastBoundaries.js +32 -0
  12. package/dist/esm/components/ui/Chart/components/ForecastLine.js +24 -0
  13. package/dist/esm/components/ui/Chart/components/HistoricalLine.js +24 -0
  14. package/dist/esm/components/ui/Chart/hooks/useChartAnimation.js +17 -0
  15. package/dist/esm/components/ui/Chart/hooks/useChartColors.js +12 -0
  16. package/dist/esm/components/ui/Chart/hooks/useLegendState.js +30 -0
  17. package/dist/esm/components/ui/Chart/tools/formatters.js +19 -3
  18. package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.js +1 -10
  19. package/dist/esm/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.js +19 -7
  20. package/dist/esm/components/ui/Select/Select.js +3 -3
  21. package/dist/esm/components/widgets/DriverCard/DriverCard.js +6 -6
  22. package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +9 -5
  23. package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.styl.js +1 -1
  24. package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.styl.js +1 -1
  25. package/dist/esm/index.js +10 -1
  26. package/dist/esm/types/src/components/ui/AnalysesSelector/AnalysesSelector.d.ts +1 -1
  27. package/dist/esm/types/src/components/ui/AnalysesSelector/AnalysesSelector.types.d.ts +7 -1
  28. package/dist/esm/types/src/components/ui/AnalysesSelector/SelectInlineRenamer.d.ts +12 -0
  29. package/dist/esm/types/src/components/ui/Chart/Chart.d.ts +11 -2
  30. package/dist/esm/types/src/components/ui/Chart/components/BaseChartWrapper.d.ts +7 -1
  31. package/dist/esm/types/src/components/ui/Chart/components/index.d.ts +1 -1
  32. package/dist/esm/types/src/components/ui/Chart/tools/formatters.d.ts +3 -1
  33. package/dist/esm/types/src/components/ui/ChartAreaInteractive/index.d.ts +1 -1
  34. package/dist/esm/types/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.d.ts +1 -1
  35. package/dist/esm/types/src/components/ui/Select/Select.d.ts +1 -1
  36. package/dist/esm/types/src/components/ui/Select/Select.types.d.ts +1 -0
  37. package/dist/esm/types/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.d.ts +1 -3
  38. package/package.json +1 -1
  39. package/src/components/ui/AnalysesSelector/AnalysesSelector.styl +62 -1
  40. package/src/components/ui/AnalysesSelector/AnalysesSelector.styl.d.ts +8 -0
  41. package/src/components/ui/AnalysesSelector/AnalysesSelector.tsx +136 -27
  42. package/src/components/ui/AnalysesSelector/AnalysesSelector.types.ts +7 -2
  43. package/src/components/ui/AnalysesSelector/SelectInlineRenamer.tsx +191 -0
  44. package/src/components/ui/Button/Button.styl +5 -8
  45. package/src/components/ui/Chart/Chart.tsx +21 -1
  46. package/src/components/ui/Chart/components/BaseChartWrapper.styl +9 -0
  47. package/src/components/ui/Chart/components/BaseChartWrapper.styl.d.ts +2 -0
  48. package/src/components/ui/Chart/components/BaseChartWrapper.tsx +62 -14
  49. package/src/components/ui/Chart/components/CustomChartLegend/CustomChartLegend.tsx +2 -3
  50. package/src/components/ui/Chart/components/index.ts +5 -1
  51. package/src/components/ui/Chart/tools/formatters.ts +20 -2
  52. package/src/components/ui/ChartAreaInteractive/index.ts +15 -1
  53. package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.test.tsx +17 -0
  54. package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.tsx +23 -7
  55. package/src/components/ui/Select/Select.tsx +13 -5
  56. package/src/components/ui/Select/Select.types.ts +1 -0
  57. package/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.ts +1 -3
  58. package/src/components/widgets/DriverCard/DriverCard.tsx +7 -8
  59. package/src/components/widgets/DriversComparisonChart/DriversComparisonChart.styl +0 -1
  60. package/src/components/widgets/PerformanceChart/PerformanceChart.styl +1 -1
  61. package/src/docs/components/DocsSidebar/DocsSidebar.tsx +7 -2
@@ -1,22 +1,32 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { EyeClosedIcon, EyeIcon } from '@phosphor-icons/react';
3
- import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../Select/Select.js';
4
- import { useRef, useMemo, useEffect } from 'react';
2
+ import cn from 'classnames';
3
+ import { useRef, useMemo, useEffect, useState } from 'react';
5
4
  import { AnalysisLineIcon } from '../AnalysisLineIcon/AnalysisLineIcon.js';
6
5
  import { Badge } from '../Badge/Badge.js';
7
6
  import { LabelWithId } from '../LabelWithId/LabelWithId.js';
8
- import S from './AnalysesSelector.styl.js';
7
+ import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../Select/Select.js';
9
8
  import { TextShimmer } from '../TextShimmer/TextShimmer.js';
10
- import cn from 'classnames';
11
9
  import { getLatestByUpdatedAt } from '../../../utils/analysisDate.js';
10
+ import { EyeClosedIcon, EyeIcon } from '@phosphor-icons/react';
11
+ import S from './AnalysesSelector.styl.js';
12
+ import { SelectInlineRenamer } from './SelectInlineRenamer.js';
12
13
 
13
14
  const isFailed = (item) => item.status?.toLowerCase() === 'fail';
14
15
  const isDashedIcon = (item) => item.id !== -1;
15
16
  const defaultIsAnalysisInProgress = (status) => ['pending', 'running', 'cancelling'].includes(status?.toLowerCase() ?? '');
17
+ const shouldBlockSelectKeydownWhileRenaming = (e) => {
18
+ if (!(e.target instanceof HTMLInputElement)) {
19
+ return true;
20
+ }
21
+ return (e.key === 'ArrowUp' ||
22
+ e.key === 'ArrowDown' ||
23
+ e.key === ' ' ||
24
+ e.key === 'Enter');
25
+ };
16
26
  function renderItemContent(item) {
17
27
  const failed = isFailed(item);
18
28
  if (failed) {
19
- return (jsx(Badge, { variant: "red", squared: true, children: "failed" }));
29
+ return (jsx(Badge, { variant: "red", className: S.itemBadge, children: "failed" }));
20
30
  }
21
31
  const color = item.color || 'var(--foreground)';
22
32
  return (jsx(AnalysisLineIcon, { color: color, variant: isDashedIcon(item) ? 'dashed' : 'solid' }));
@@ -29,7 +39,7 @@ function renderIcon(icon) {
29
39
  }
30
40
  return (jsx("span", { "data-slot": "analysis-icon", className: cn(S.icon, S.iconWrapper), children: icon }));
31
41
  }
32
- function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false, placeholder, disabled, size = 'md', variant = 'default', darker = false, className, triggerProps, onFailedItemClick, showHistorical = true, enableToggleHidden = false, maxVisibleItems = 1, preventDeselection = false, hiddenSeries: hiddenSeriesProp = new Set(), onToggleSeries = () => { }, isAnalysisInProgress: isAnalysisInProgressProp = defaultIsAnalysisInProgress, }) {
42
+ function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false, placeholder, disabled, size = 'md', variant = 'default', darker = false, className, triggerProps, onFailedItemClick, showHistorical = true, enableToggleHidden = false, maxVisibleItems = 1, preventDeselection = false, hiddenSeries: hiddenSeriesProp = new Set(), onToggleSeries = () => { }, isAnalysisInProgress: isAnalysisInProgressProp = defaultIsAnalysisInProgress, rename, }) {
33
43
  const historicalAutoSelectedRef = useRef(false);
34
44
  const hiddenSeries = hiddenSeriesProp;
35
45
  const toggleSeries = (analysisId) => {
@@ -130,6 +140,18 @@ function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false
130
140
  onItemToggle(-1);
131
141
  }
132
142
  }, [showHistorical, selectedIds, onItemToggle]);
143
+ const selectedItem = items.find(item => selectedSet.has(item.id)) ?? items[0];
144
+ const selectedId = selectedItem?.id;
145
+ const [isRenaming, setIsRenaming] = useState(false);
146
+ const [selectOpen, setSelectOpen] = useState(false);
147
+ useEffect(() => {
148
+ setIsRenaming(false);
149
+ }, [selectedId, rename?.value]);
150
+ useEffect(() => {
151
+ if (isRenaming) {
152
+ setSelectOpen(false);
153
+ }
154
+ }, [isRenaming]);
133
155
  const handleSelectValue = (value) => {
134
156
  if (!value)
135
157
  return;
@@ -175,14 +197,39 @@ function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false
175
197
  }
176
198
  if (items.length === 0)
177
199
  return null;
178
- const selectedId = items.find(item => selectedSet.has(item.id))?.id ?? items[0]?.id;
179
200
  const selectValue = selectedId != null ? String(selectedId) : '';
180
- return (jsx("div", { className: cn(S.root, className), children: jsxs(Select, { value: selectValue, onValueChange: handleSelectValue, disabled: disabled, children: [jsx(SelectTrigger, { size: size, variant: variant, darker: darker, className: S.selectTrigger, hideChevron: items.length < 2, style: {
181
- minWidth: 'auto',
182
- height: 'auto',
183
- fontSize: 'var(--text-xs)',
184
- pointerEvents: items.length < 2 ? 'none' : undefined,
185
- }, ...triggerProps, children: jsx(SelectValue, { placeholder: selectPlaceholder }) }), jsx(SelectContent, { children: items.map(item => (jsx(SelectItem, { value: String(item.id), selected: String(item.id) === selectValue, children: renderSelectItem(item) }, item.id))) })] }) }));
201
+ const showRenamer = rename && selectedItem && rename.renameableItemIds.has(selectedItem.id);
202
+ const singleItemSelect = items.length < 2;
203
+ const { className: triggerClassName, ...restTriggerProps } = triggerProps ?? {};
204
+ const triggerStyle = {
205
+ minWidth: 'auto',
206
+ height: 'auto',
207
+ fontSize: 'var(--text-xs)',
208
+ pointerEvents: singleItemSelect && !showRenamer ? 'none' : undefined,
209
+ };
210
+ const triggerClassNameMerged = cn(S.selectTrigger, isRenaming && S.selectTriggerRenaming, triggerClassName);
211
+ const renamerTriggerContent = showRenamer ? (jsxs("div", { className: cn(S.selectTriggerContent, disabled && S.selectTriggerRenamerDisabled), children: [renderItemContent(selectedItem), renderIcon(selectedItem.icon), jsx(SelectInlineRenamer, { value: rename.value, displayLabel: selectedItem.label, onChange: rename.onChange, disabled: disabled, className: S.selectTriggerRenamer, isRenaming: isRenaming, onEnterRenaming: () => setIsRenaming(prev => !prev) })] })) : null;
212
+ return (jsx("div", { className: cn(S.root, className), children: jsxs(Select, { value: selectValue, onValueChange: handleSelectValue, disabled: disabled, open: isRenaming || singleItemSelect ? false : selectOpen, onOpenChange: open => {
213
+ if (!isRenaming && !singleItemSelect) {
214
+ setSelectOpen(open);
215
+ }
216
+ }, children: [jsx(SelectTrigger, { asChild: showRenamer, size: size, variant: variant, darker: darker, hideChevron: singleItemSelect, ...restTriggerProps, ...(showRenamer
217
+ ? {}
218
+ : {
219
+ style: triggerStyle,
220
+ className: triggerClassNameMerged,
221
+ onKeyDown: (e) => {
222
+ if (isRenaming && shouldBlockSelectKeydownWhileRenaming(e)) {
223
+ e.preventDefault();
224
+ e.stopPropagation();
225
+ }
226
+ },
227
+ }), children: showRenamer ? (jsx("div", { className: triggerClassNameMerged, style: triggerStyle, onKeyDown: e => {
228
+ if (isRenaming && shouldBlockSelectKeydownWhileRenaming(e)) {
229
+ e.preventDefault();
230
+ e.stopPropagation();
231
+ }
232
+ }, children: renamerTriggerContent })) : (jsx(LabelWithId, { className: S.selectTriggerLabelWithId, id: selectValue, label: jsx(SelectValue, { placeholder: selectPlaceholder }) })) }), jsx(SelectContent, { children: items.map(item => (jsx(SelectItem, { value: String(item.id), selected: selectedSet.has(item.id), textValue: item.label, children: renderSelectItem(item) }, item.id))) })] }) }));
186
233
  }
187
234
 
188
235
  export { AnalysesSelector };
@@ -1,7 +1,7 @@
1
1
  import styleInject from 'style-inject';
2
2
 
3
- var css_248z = ".AnalysesSelector_root__V8v0T{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.AnalysesSelector_variant-default__lbURP.AnalysesSelector_single__rAPT6{background-color:var(--background);border-radius:var(--p-4);padding:0 var(--p-2)}.AnalysesSelector_item__d3pDt{align-items:center;cursor:pointer;display:flex;gap:var(--p-2);margin:var(--p-1);transition:opacity .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.AnalysesSelector_item__d3pDt.AnalysesSelector_disabled__6JhJQ,.AnalysesSelector_item__d3pDt:hover{opacity:.5}.AnalysesSelector_item__d3pDt.AnalysesSelector_disabled__6JhJQ:hover{opacity:.8}.AnalysesSelector_item__d3pDt.AnalysesSelector_historical__hAqpN{pointer-events:none}.AnalysesSelector_item__d3pDt.AnalysesSelector_dimmed__mYWY7{opacity:.5}.AnalysesSelector_icon__1Tb0U{flex-shrink:0;height:16px;max-height:16px;max-width:16px;overflow:hidden;width:16px}.AnalysesSelector_iconImage__r9yJx{display:block;-o-object-fit:contain;object-fit:contain}.AnalysesSelector_iconWrapper__2Kx8j{align-items:center;display:flex;justify-content:center;position:relative}.AnalysesSelector_iconWrapper__2Kx8j>img{height:100%;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;width:100%}[data-slot=select-item] [data-slot=analysis-icon]{flex-shrink:0;height:16px!important;max-height:16px!important;max-width:16px!important;-o-object-fit:contain;object-fit:contain;overflow:hidden;width:16px!important}.AnalysesSelector_label__m-9Ml{flex-grow:1;font-size:var(--text-xs);white-space:nowrap}.AnalysesSelector_selectItemContent__iRsNR{align-items:center;display:flex;gap:var(--p-2);width:100%}.AnalysesSelector_selectTrigger__Avjkd{font-size:var(--text-xs);height:auto;min-width:auto}.AnalysesSelector_selectTriggerLabelWithId__C32ph{display:flex}.AnalysesSelector_itemLabelWithId__8c0mY{align-items:center;display:flex;flex-grow:1;min-width:0}";
4
- var S = {"root":"AnalysesSelector_root__V8v0T","variant-default":"AnalysesSelector_variant-default__lbURP","single":"AnalysesSelector_single__rAPT6","item":"AnalysesSelector_item__d3pDt","disabled":"AnalysesSelector_disabled__6JhJQ","historical":"AnalysesSelector_historical__hAqpN","dimmed":"AnalysesSelector_dimmed__mYWY7","icon":"AnalysesSelector_icon__1Tb0U","iconImage":"AnalysesSelector_iconImage__r9yJx","iconWrapper":"AnalysesSelector_iconWrapper__2Kx8j","label":"AnalysesSelector_label__m-9Ml","selectItemContent":"AnalysesSelector_selectItemContent__iRsNR","selectTrigger":"AnalysesSelector_selectTrigger__Avjkd","selectTriggerLabelWithId":"AnalysesSelector_selectTriggerLabelWithId__C32ph","itemLabelWithId":"AnalysesSelector_itemLabelWithId__8c0mY"};
3
+ var css_248z = ".AnalysesSelector_root__V8v0T{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.AnalysesSelector_selectTriggerRenamer__rZmCN{min-width:0}.AnalysesSelector_selectInlineRenamer__pGAz0{align-items:center;display:flex;min-width:0}.AnalysesSelector_selectInlineRenamerInput__7al7v{border-radius:var(--p-2);margin-left:calc(var(--p-2)*-1);max-width:calc(100% - var(--p-4))!important;padding:0 var(--p-2)}.AnalysesSelector_renamerEditButton__lJ-8-{flex-shrink:0;opacity:.5;transition:opacity .2s ease-out}.AnalysesSelector_selectInlineRenamer__pGAz0:hover .AnalysesSelector_renamerEditButton__lJ-8-{opacity:1}.AnalysesSelector_variant-default__lbURP.AnalysesSelector_single__rAPT6{background-color:var(--background);border-radius:var(--p-4);padding:0 var(--p-2)}.AnalysesSelector_item__d3pDt{align-items:center;cursor:pointer;display:flex;gap:var(--p-2);margin:var(--p-1);transition:opacity .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.AnalysesSelector_item__d3pDt.AnalysesSelector_disabled__6JhJQ,.AnalysesSelector_item__d3pDt:hover{opacity:.5}.AnalysesSelector_item__d3pDt.AnalysesSelector_disabled__6JhJQ:hover{opacity:.8}.AnalysesSelector_item__d3pDt.AnalysesSelector_historical__hAqpN{pointer-events:none}.AnalysesSelector_item__d3pDt.AnalysesSelector_dimmed__mYWY7{opacity:.5}.AnalysesSelector_itemBadge__WImMg{margin-bottom:-2px;margin-top:-2px}.AnalysesSelector_icon__1Tb0U{flex-shrink:0;height:16px;max-height:16px;max-width:16px;overflow:hidden;width:16px}.AnalysesSelector_iconImage__r9yJx{display:block;-o-object-fit:contain;object-fit:contain}.AnalysesSelector_iconWrapper__2Kx8j{align-items:center;display:flex;justify-content:center;position:relative}.AnalysesSelector_iconWrapper__2Kx8j>img{height:100%;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;width:100%}[data-slot=select-item] [data-slot=analysis-icon]{flex-shrink:0;height:16px!important;max-height:16px!important;max-width:16px!important;-o-object-fit:contain;object-fit:contain;overflow:hidden;width:16px!important}.AnalysesSelector_label__m-9Ml{flex:1 1 auto;font-size:var(--text-xs);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AnalysesSelector_selectItemContent__iRsNR{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap;gap:var(--p-2);min-width:0;width:100%}.AnalysesSelector_selectTrigger__Avjkd{font-size:var(--text-xs);height:auto;min-width:auto}.AnalysesSelector_selectTriggerRenaming__w0xCm{max-width:100%!important;width:100%!important}.AnalysesSelector_selectTriggerRenaming__w0xCm .AnalysesSelector_selectTriggerContent__RwRJL{flex:1;min-width:0;width:100%}.AnalysesSelector_selectTriggerRenaming__w0xCm .AnalysesSelector_selectTriggerRenamer__rZmCN{min-width:0}.AnalysesSelector_selectTriggerLabelWithId__C32ph{display:flex}.AnalysesSelector_selectTriggerContent__RwRJL{align-items:center;display:flex;gap:var(--p-2);min-height:var(--p-9);min-width:0}.AnalysesSelector_selectTriggerContent__RwRJL>:last-child{flex-shrink:0;max-width:100%;min-width:0}.AnalysesSelector_selectTriggerRenamerDisabled__bA8-G button{pointer-events:none}.AnalysesSelector_itemLabelWithId__8c0mY{align-items:center;display:flex;flex-grow:1;min-width:0}";
4
+ var S = {"root":"AnalysesSelector_root__V8v0T","selectTriggerRenamer":"AnalysesSelector_selectTriggerRenamer__rZmCN","selectInlineRenamer":"AnalysesSelector_selectInlineRenamer__pGAz0","selectInlineRenamerInput":"AnalysesSelector_selectInlineRenamerInput__7al7v","renamerEditButton":"AnalysesSelector_renamerEditButton__lJ-8-","variant-default":"AnalysesSelector_variant-default__lbURP","single":"AnalysesSelector_single__rAPT6","item":"AnalysesSelector_item__d3pDt","disabled":"AnalysesSelector_disabled__6JhJQ","historical":"AnalysesSelector_historical__hAqpN","dimmed":"AnalysesSelector_dimmed__mYWY7","itemBadge":"AnalysesSelector_itemBadge__WImMg","icon":"AnalysesSelector_icon__1Tb0U","iconImage":"AnalysesSelector_iconImage__r9yJx","iconWrapper":"AnalysesSelector_iconWrapper__2Kx8j","label":"AnalysesSelector_label__m-9Ml","selectItemContent":"AnalysesSelector_selectItemContent__iRsNR","selectTrigger":"AnalysesSelector_selectTrigger__Avjkd","selectTriggerRenaming":"AnalysesSelector_selectTriggerRenaming__w0xCm","selectTriggerContent":"AnalysesSelector_selectTriggerContent__RwRJL","selectTriggerLabelWithId":"AnalysesSelector_selectTriggerLabelWithId__C32ph","selectTriggerRenamerDisabled":"AnalysesSelector_selectTriggerRenamerDisabled__bA8-G","itemLabelWithId":"AnalysesSelector_itemLabelWithId__8c0mY"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { S as default };
@@ -0,0 +1,102 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { useState, useEffect, useCallback } from 'react';
4
+ import { Button } from '../Button/Button.js';
5
+ import { Input } from '../Input/Input.js';
6
+ import { TextShimmer } from '../TextShimmer/TextShimmer.js';
7
+ import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
8
+ import { PencilSimpleIcon } from '@phosphor-icons/react';
9
+ import S from './AnalysesSelector.styl.js';
10
+
11
+ const LABEL_MAX = 64;
12
+ const MANUALLY_ADJUSTED_NAME = 'Manually adjusted';
13
+ const MANUALLY_ADJUSTED_RENAME_MAX = LABEL_MAX - MANUALLY_ADJUSTED_NAME.length;
14
+ const stopSelectBubble = (e) => {
15
+ e.stopPropagation();
16
+ };
17
+ const stopSelectOpen = (e) => {
18
+ e.preventDefault();
19
+ e.stopPropagation();
20
+ };
21
+ const stopRenamerKeyboardBubble = (e) => {
22
+ e.stopPropagation();
23
+ e.nativeEvent.stopImmediatePropagation();
24
+ };
25
+ function SelectInlineRenamer({ value, displayLabel, onChange, onEnterRenaming, disabled, className, isRenaming, }) {
26
+ const [draft, setDraft] = useState(value);
27
+ const [isSaving, setIsSaving] = useState(false);
28
+ useEffect(() => {
29
+ if (!isSaving) {
30
+ setDraft(value);
31
+ }
32
+ }, [value, isSaving]);
33
+ const exitRenaming = useCallback(() => {
34
+ if (isRenaming) {
35
+ onEnterRenaming();
36
+ }
37
+ }, [isRenaming, onEnterRenaming]);
38
+ const persistRename = useCallback(async (trimmed) => {
39
+ setIsSaving(true);
40
+ setDraft(trimmed);
41
+ exitRenaming();
42
+ try {
43
+ await onChange(trimmed);
44
+ }
45
+ catch {
46
+ setDraft(value);
47
+ }
48
+ finally {
49
+ setIsSaving(false);
50
+ }
51
+ }, [exitRenaming, onChange, value]);
52
+ const commit = useCallback(() => {
53
+ const trimmed = draft.trim();
54
+ if (trimmed && trimmed !== value) {
55
+ void persistRename(trimmed);
56
+ return;
57
+ }
58
+ exitRenaming();
59
+ setDraft(value);
60
+ }, [draft, exitRenaming, persistRename, value]);
61
+ const cancel = useCallback(() => {
62
+ exitRenaming();
63
+ setDraft(value);
64
+ }, [exitRenaming, value]);
65
+ const onKeyDown = useCallback((e) => {
66
+ stopRenamerKeyboardBubble(e);
67
+ if (e.key === 'Enter' && draft.trim()) {
68
+ e.preventDefault();
69
+ const trimmed = draft.trim();
70
+ if (trimmed !== value) {
71
+ void persistRename(trimmed);
72
+ return;
73
+ }
74
+ exitRenaming();
75
+ setDraft(trimmed);
76
+ }
77
+ if (e.key === 'Escape') {
78
+ e.preventDefault();
79
+ cancel();
80
+ }
81
+ }, [cancel, draft, exitRenaming, persistRename, value]);
82
+ const onKeyUp = useCallback((e) => {
83
+ if (e.key !== ' ')
84
+ return;
85
+ e.preventDefault();
86
+ e.stopPropagation();
87
+ }, []);
88
+ const onDraftChange = useCallback((e) => {
89
+ setDraft(e.target.value.slice(0, MANUALLY_ADJUSTED_RENAME_MAX));
90
+ }, []);
91
+ if (isRenaming) {
92
+ return (jsx(Input, { className: cn(S.selectInlineRenamerInput, className), autoFocus: true, variant: "clean", size: "sm", value: draft, maxLength: MANUALLY_ADJUSTED_RENAME_MAX, onChange: onDraftChange, onBlur: commit, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onPointerDown: stopSelectBubble, onClick: stopSelectBubble }));
93
+ }
94
+ const triggerLabel = isSaving ? draft : (displayLabel ?? value);
95
+ return (jsxs("div", { className: cn(S.selectInlineRenamer, className), children: [isSaving ? (jsx(TextShimmer, { as: "span", className: S.label, children: triggerLabel })) : (jsx("span", { className: S.label, children: triggerLabel })), !disabled && !isSaving && (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { variant: "ghost", size: "sm", type: "button", className: S.renamerEditButton, onPointerDown: stopSelectOpen, onClick: e => {
96
+ e.stopPropagation();
97
+ setDraft(value);
98
+ onEnterRenaming();
99
+ }, children: jsx(PencilSimpleIcon, { size: 16 }) }) }), jsx(TooltipContent, { side: "bottom", children: "Rename" })] }))] }));
100
+ }
101
+
102
+ export { SelectInlineRenamer };
@@ -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-900)}.Button_destructive__g1Ume:focus-visible{ring:3px var(--destructive-200)}.dark .Button_destructive__g1Ume{background-color:var(--destructive-600)}.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:var(--p-3) 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}";
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
 
@@ -5,22 +5,26 @@ import 'classnames';
5
5
  import 'react';
6
6
  import './Chart.context.js';
7
7
  import './Chart.styl.js';
8
- import '@phosphor-icons/react';
9
- import '@radix-ui/react-select';
10
- import 'lucide-react';
11
- import '../Select/Select.styl.js';
12
8
  import '../AnalysisLineIcon/AnalysisLineIcon.styl.js';
13
9
  import '@radix-ui/react-slot';
14
10
  import '../Badge/Badge.styl.js';
15
11
  import '../LabelWithId/LabelWithId.styl.js';
16
- import '../AnalysesSelector/AnalysesSelector.styl.js';
12
+ import '@radix-ui/react-select';
13
+ import 'lucide-react';
14
+ import '../Select/Select.styl.js';
17
15
  import '../TextShimmer/TextShimmer.js';
16
+ import '@phosphor-icons/react';
17
+ import '../AnalysesSelector/AnalysesSelector.styl.js';
18
+ import '../Button/Button.styl.js';
19
+ import '../Input/Input.js';
20
+ import '../Tooltip/Tooltip.js';
18
21
  import './components/CustomChartLegend/CustomChartLegend.styl.js';
19
22
  import '../ChartAreaInteractive/ChartLines.js';
20
23
  import '../Skeleton/Skeleton.styl.js';
21
24
  import 'lightweight-charts';
22
25
  import './lightweight/LightweightForecastChart.styl.js';
23
26
  import './components/ChartEmptyState/ChartEmptyState.styl.js';
27
+ export { DEFAULT_QUANTILE_BAND_COLOR, QuantileBands } from './components/QuantileBands.js';
24
28
 
25
29
  const ChartTooltip = RechartsPrimitive.Tooltip;
26
30
  const ChartLegend = RechartsPrimitive.Legend;
@@ -0,0 +1,23 @@
1
+ const FORECAST_COLORS = {
2
+ historical: {
3
+ light: '#000000',
4
+ dark: '#ffffff',
5
+ },
6
+ forecast: {
7
+ light: '#3a0087',
8
+ dark: '#8b5cf6',
9
+ },
10
+ confidence: {
11
+ light: 'rgba(58, 0, 135, 0.35)',
12
+ dark: 'rgba(139, 92, 246, 0.35)',
13
+ },
14
+ boundary: {
15
+ positive: '#77d400',
16
+ negative: '#fc512b',
17
+ neutral: '#ffae00',
18
+ },
19
+ };
20
+ const ANIMATION_DURATION = 800;
21
+ const ANIMATION_BEGIN = 0;
22
+
23
+ export { ANIMATION_BEGIN, ANIMATION_DURATION, FORECAST_COLORS };
@@ -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
- // Return empty div to wait for chartData to be populated
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
- // Return empty div to wait for initialization to complete
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
- return (jsx("div", { className: cn(S.root, className), children: jsx("div", { className: S.errorContainer, children: noDataMessage }) }));
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: cn(props.className, props.loadingComponentClassName), height: props.height, loadingMessage: props.loadingMessage }));
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: cn(props.className, props.loadingComponentClassName), height: props.height, loadingMessage: props.loadingMessage }));
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 };
@@ -0,0 +1,9 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { Area } from 'recharts';
3
+ import { ANIMATION_DURATION, ANIMATION_BEGIN } from '../chartForecastVisualization.constants.js';
4
+
5
+ function ConfidenceBands({ color, hidden = false, animate = false, }) {
6
+ return (jsxs(Fragment, { children: [jsx(Area, { type: "monotone", dataKey: "lower_boundary", stroke: "transparent", fill: "transparent", isAnimationActive: animate, animationDuration: ANIMATION_DURATION, animationBegin: ANIMATION_BEGIN, connectNulls: true, hide: hidden }), jsx(Area, { type: "monotone", dataKey: "upper_boundary", stroke: "transparent", fill: color, fillOpacity: 0.35, isAnimationActive: animate, animationDuration: ANIMATION_DURATION, animationBegin: ANIMATION_BEGIN, connectNulls: true, hide: hidden })] }));
7
+ }
8
+
9
+ export { ConfidenceBands };
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import cn from 'classnames';
3
2
  import { useMemo, useCallback } from 'react';
4
3
  import { AnalysesSelector } from '../../../AnalysesSelector/AnalysesSelector.js';
5
4
  import S from './CustomChartLegend.styl.js';
5
+ import cn from 'classnames';
6
6
 
7
7
  function extractIdFromDataKey(dataKey) {
8
8
  if (!dataKey)
@@ -58,7 +58,7 @@ function CustomChartLegend({ payload, onClick, hiddenSeries, className, onAnalys
58
58
  }, [onClick, payload, hiddenSeries, onAnalysisSelect]);
59
59
  if (!items.length)
60
60
  return null;
61
- return (jsx("div", { className: cn(S.legendContainer, className), children: jsx(AnalysesSelector, { items: items, selectedIds: selectedIds, onItemToggle: handleItemToggle, inlineMode: true, size: "sm", variant: "clear", onFailedItemClick: onFailedAnalysisClick, enableToggleHidden: true, maxVisibleItems: maxVisibleItems, preventDeselection: preventDeselection, hiddenSeries: hiddenSeries ?? new Set(), onToggleSeries: handleToggleSeriesVisibility }) }));
61
+ return (jsx("div", { className: cn(S.legendContainer, className), children: jsx(AnalysesSelector, { items: items, selectedIds: selectedIds, onItemToggle: handleItemToggle, inlineMode: true, size: "xs", variant: "clear", onFailedItemClick: onFailedAnalysisClick, enableToggleHidden: true, maxVisibleItems: maxVisibleItems, preventDeselection: preventDeselection, hiddenSeries: hiddenSeries ?? new Set(), onToggleSeries: handleToggleSeriesVisibility }) }));
62
62
  }
63
63
 
64
64
  export { CustomChartLegend };
@@ -0,0 +1,32 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { ReferenceLine } from 'recharts';
3
+ import { FORECAST_COLORS } from '../chartForecastVisualization.constants.js';
4
+
5
+ function ForecastBoundaries({ changePoints, chartData, isDarkTheme, }) {
6
+ const meanCPD = changePoints.MeanCPD.change_points[0];
7
+ const sensitivity = changePoints.MeanCPD.cpd_metrics.sensitivity_threshold;
8
+ if (!meanCPD)
9
+ return null;
10
+ const sign = meanCPD.sign;
11
+ const prevCoef = meanCPD.prev_coef[0];
12
+ // Calculate boundary values
13
+ const upperBoundary = prevCoef + sensitivity;
14
+ const lowerBoundary = prevCoef - sensitivity;
15
+ // Determine color based on trend sign
16
+ const boundaryColor = sign === 0
17
+ ? FORECAST_COLORS.boundary.neutral
18
+ : sign > 0
19
+ ? FORECAST_COLORS.boundary.positive
20
+ : FORECAST_COLORS.boundary.negative;
21
+ return (jsxs(Fragment, { children: [jsx(ReferenceLine, { y: upperBoundary, stroke: boundaryColor, strokeDasharray: "5 5", strokeWidth: 2, label: {
22
+ value: 'Upper Boundary',
23
+ position: 'insideTopRight',
24
+ fill: isDarkTheme ? '#9ca3af' : '#6b7280',
25
+ } }), sign <= 0 && (jsx(ReferenceLine, { y: lowerBoundary, stroke: boundaryColor, strokeDasharray: "5 5", strokeWidth: 2, label: {
26
+ value: 'Lower Boundary',
27
+ position: 'insideBottomRight',
28
+ fill: isDarkTheme ? '#9ca3af' : '#6b7280',
29
+ } }))] }));
30
+ }
31
+
32
+ export { ForecastBoundaries };
@@ -0,0 +1,24 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Line } from 'recharts';
3
+
4
+ function ForecastLine({ color, isDarkTheme, hidden, animate, animationDuration, animationBegin, name = 'Forecast', dataKey = 'forecast', }) {
5
+ return (jsx(Line, { type: "monotone", dataKey: dataKey, stroke: color, strokeWidth: 1, strokeDasharray: "4 2", dot: props => {
6
+ const { index, payload } = props;
7
+ // Show dot only at the last forecast data point
8
+ if (payload &&
9
+ payload[dataKey] !== undefined &&
10
+ index === props.payload?.length - 1) {
11
+ return (jsx("circle", { cx: props.cx, cy: props.cy, r: 3, fill: color }, `forecast-dot-${index}`));
12
+ }
13
+ return jsx("g", {}, `forecast-dot-empty-${index}`);
14
+ }, activeDot: {
15
+ r: 6,
16
+ fill: color,
17
+ stroke: isDarkTheme ? '#000000' : '#FFFFFF',
18
+ strokeWidth: 3,
19
+ filter: 'drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.2))',
20
+ style: { zIndex: 20 },
21
+ }, name: name, hide: hidden, isAnimationActive: animate, animationDuration: animationDuration, animationBegin: animationBegin, animationEasing: "ease-out", connectNulls: true }));
22
+ }
23
+
24
+ export { ForecastLine };
@@ -0,0 +1,24 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Line } from 'recharts';
3
+
4
+ function HistoricalLine({ color, isDarkTheme, hidden, animate, animationDuration, animationBegin, name = 'Historical', dataKey = 'historical', }) {
5
+ return (jsx(Line, { type: "monotone", dataKey: dataKey, stroke: color, strokeWidth: 1, dot: props => {
6
+ const { index, payload } = props;
7
+ // Show dot only at the last historical data point
8
+ if (payload &&
9
+ payload[dataKey] !== undefined &&
10
+ index === props.payload?.length - 1) {
11
+ return (jsx("circle", { cx: props.cx, cy: props.cy, r: 3, fill: color }, `historical-dot-${index}`));
12
+ }
13
+ return jsx("g", {}, `historical-dot-empty-${index}`);
14
+ }, activeDot: {
15
+ r: 6,
16
+ fill: color,
17
+ stroke: isDarkTheme ? '#000000' : '#FFFFFF',
18
+ strokeWidth: 3,
19
+ filter: 'drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.2))',
20
+ style: { zIndex: 20 },
21
+ }, name: name, hide: hidden, isAnimationActive: animate, animationDuration: animationDuration, animationBegin: animationBegin, animationEasing: "ease-out", connectNulls: true }));
22
+ }
23
+
24
+ export { HistoricalLine };
@@ -0,0 +1,17 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ /**
4
+ * Hook to manage chart animation state
5
+ * Triggers animation on data change and resets after duration
6
+ */
7
+ function useChartAnimation(chartData, duration = 1000) {
8
+ const [shouldAnimate, setShouldAnimate] = useState(false);
9
+ useEffect(() => {
10
+ setShouldAnimate(true);
11
+ const timer = setTimeout(() => setShouldAnimate(false), duration);
12
+ return () => clearTimeout(timer);
13
+ }, [chartData, duration]);
14
+ return shouldAnimate;
15
+ }
16
+
17
+ export { useChartAnimation };
@@ -0,0 +1,12 @@
1
+ function useChartColors(colors, isDarkTheme) {
2
+ const result = {};
3
+ for (const key in colors) {
4
+ const colorScheme = colors[key];
5
+ if (colorScheme?.light && colorScheme?.dark) {
6
+ result[key] = isDarkTheme ? colorScheme.dark : colorScheme.light;
7
+ }
8
+ }
9
+ return result;
10
+ }
11
+
12
+ export { useChartColors };
@@ -0,0 +1,30 @@
1
+ import { useState } from 'react';
2
+
3
+ /**
4
+ * Hook to manage chart legend state
5
+ * Handles showing/hiding series on legend click
6
+ */
7
+ function useLegendState() {
8
+ const [hiddenSeries, setHiddenSeries] = useState(new Set());
9
+ const toggleSeries = (seriesName) => {
10
+ setHiddenSeries(prev => {
11
+ const newSet = new Set(prev);
12
+ if (newSet.has(seriesName)) {
13
+ newSet.delete(seriesName);
14
+ }
15
+ else {
16
+ newSet.add(seriesName);
17
+ }
18
+ return newSet;
19
+ });
20
+ };
21
+ const clearHiddenSeries = () => {
22
+ setHiddenSeries(new Set());
23
+ };
24
+ const showOnlySeries = (dataKey, allDataKeys) => {
25
+ setHiddenSeries(new Set(allDataKeys.filter(key => key !== dataKey)));
26
+ };
27
+ return { hiddenSeries, toggleSeries, clearHiddenSeries, showOnlySeries };
28
+ }
29
+
30
+ export { useLegendState };
@@ -1,15 +1,31 @@
1
1
  /**
2
- * Format number for display (with k/m abbreviations)
2
+ * Format number for display (with k/m/b abbreviations)
3
3
  */
4
4
  const formatNumber = (value) => {
5
+ if (Math.abs(value) >= 1000000000) {
6
+ return (value / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B';
7
+ }
5
8
  if (Math.abs(value) >= 1000000) {
6
9
  return (value / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
7
10
  }
8
- else if (Math.abs(value) >= 1000) {
11
+ if (Math.abs(value) >= 1000) {
9
12
  return (value / 1000).toFixed(1).replace(/\.0$/, '') + 'K';
10
13
  }
11
14
  return value.toFixed(0);
12
15
  };
16
+ /** Shorter Y-axis style labels (integer B/M/K) for tight layouts. */
17
+ const formatCompactAxisNumber = (value) => {
18
+ if (Math.abs(value) >= 1000000000) {
19
+ return `${Math.round(value / 1000000000)}B`;
20
+ }
21
+ if (Math.abs(value) >= 1000000) {
22
+ return `${Math.round(value / 1000000)}M`;
23
+ }
24
+ if (Math.abs(value) >= 1000) {
25
+ return `${Math.round(value / 1000)}K`;
26
+ }
27
+ return value.toFixed(0);
28
+ };
13
29
  /**
14
30
  * Round a number based on its magnitude
15
31
  * - 2 digits (10-99): round to nearest 10
@@ -78,4 +94,4 @@ const formatDate = (dateStr, long = false) => {
78
94
  });
79
95
  };
80
96
 
81
- export { formatDate, formatNumber, formatYAxisNumber, generateRoundedYTicks };
97
+ export { formatCompactAxisNumber, formatDate, formatNumber, formatYAxisNumber, generateRoundedYTicks };