@sybilion/uilib 1.4.3 → 1.4.5
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/agent-glossary/workspace.generated.ts +1 -1
- package/dist/agent-glossary/workspace.index.md +1 -1
- package/dist/agent-glossary/workspace.md +1 -1
- package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.js +5 -5
- package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.styl.js +2 -2
- package/dist/esm/components/ui/LabelWithId/LabelWithId.js +1 -1
- package/dist/esm/components/ui/LabelWithId/LabelWithId.styl.js +2 -2
- package/dist/esm/components/ui/NavUserHeader/NavUserHeader.js +1 -1
- package/dist/esm/components/ui/Page/PageScroll/PageScroll.js +16 -21
- package/dist/esm/components/ui/Page/pageContext.js +1 -0
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +1 -1
- package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +1 -1
- package/dist/esm/components/widgets/PerformanceChart/performanceChart.helpers.js +12 -0
- package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types/src/components/ui/Page/PageScroll/PageScroll.d.ts +10 -2
- package/dist/esm/types/src/components/ui/Page/index.d.ts +1 -0
- package/dist/esm/types/src/components/ui/Page/pageContext.d.ts +1 -0
- package/dist/esm/types/tests/performanceChart.helpers.test.d.ts +1 -0
- package/dist/esm/utils/chartConnectionPoint.js +26 -8
- package/package.json +1 -1
- package/src/components/ui/AnalysesSelector/AnalysesSelector.styl +0 -3
- package/src/components/ui/AnalysesSelector/AnalysesSelector.styl.d.ts +0 -1
- package/src/components/ui/AnalysesSelector/AnalysesSelector.tsx +11 -11
- package/src/components/ui/LabelWithId/AGENT.md +3 -3
- package/src/components/ui/LabelWithId/LabelWithId.styl +3 -0
- package/src/components/ui/LabelWithId/LabelWithId.styl.d.ts +1 -0
- package/src/components/ui/LabelWithId/LabelWithId.tsx +4 -1
- package/src/components/ui/NavUserHeader/NavUserHeader.tsx +6 -2
- package/src/components/ui/Page/PageScroll/PageScroll.tsx +45 -25
- package/src/components/ui/Page/index.ts +1 -0
- package/src/components/ui/Page/pageContext.ts +2 -0
- package/src/components/widgets/PerformanceChart/performanceChart.helpers.ts +23 -0
- package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.tsx +3 -1
- package/src/utils/chartConnectionPoint.ts +28 -8
|
@@ -40,7 +40,7 @@ Entry point for \`@sybilion/uilib\`. Open linked AGENT.md before using a compone
|
|
|
40
40
|
- [Kicker](src/components/ui/Kicker/AGENT.md) — Kicker is a small eyebrow label rendered above a heading, card, or section. It uses the 12px Manrope label style in s…
|
|
41
41
|
- [Label](src/components/ui/Label/AGENT.md) — Label is the styled form label used across the library. Link it to its control with htmlFor so clicking the label foc…
|
|
42
42
|
- [LabeledInput](src/components/ui/LabeledInput/AGENT.md) — LabeledInput combines a Label and an Input into a single row, wiring the label to the field automatically via the id …
|
|
43
|
-
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId renders
|
|
43
|
+
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId always renders the user-facing label. The label span carries \`data-analysis-id\` so PostHog session replay…
|
|
44
44
|
- [LegacyPlatformLink](src/components/ui/LegacyPlatformLink/AGENT.md) — LegacyPlatformLink is an anchor that points at the legacy platform, building the destination from the API domain plus…
|
|
45
45
|
- [Logo](src/components/ui/Logo/AGENT.md) — Logo renders the brand mark with an optional wordmark. Choose a size that fits the surrounding chrome and hide the te…
|
|
46
46
|
- [MobileAdaptiveSelector](src/components/ui/MobileAdaptiveSelector/AGENT.md) — MobileAdaptiveSelector presents a single-choice control that renders as a toggle group on desktop and switches to a s…
|
|
@@ -39,7 +39,7 @@ Entry point for `@sybilion/uilib`. Open linked AGENT.md before using a component
|
|
|
39
39
|
- [Kicker](src/components/ui/Kicker/AGENT.md) — Kicker is a small eyebrow label rendered above a heading, card, or section. It uses the 12px Manrope label style in s…
|
|
40
40
|
- [Label](src/components/ui/Label/AGENT.md) — Label is the styled form label used across the library. Link it to its control with htmlFor so clicking the label foc…
|
|
41
41
|
- [LabeledInput](src/components/ui/LabeledInput/AGENT.md) — LabeledInput combines a Label and an Input into a single row, wiring the label to the field automatically via the id …
|
|
42
|
-
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId renders
|
|
42
|
+
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId always renders the user-facing label. The label span carries `data-analysis-id` so PostHog session replay…
|
|
43
43
|
- [LegacyPlatformLink](src/components/ui/LegacyPlatformLink/AGENT.md) — LegacyPlatformLink is an anchor that points at the legacy platform, building the destination from the API domain plus…
|
|
44
44
|
- [Logo](src/components/ui/Logo/AGENT.md) — Logo renders the brand mark with an optional wordmark. Choose a size that fits the surrounding chrome and hide the te…
|
|
45
45
|
- [MobileAdaptiveSelector](src/components/ui/MobileAdaptiveSelector/AGENT.md) — MobileAdaptiveSelector presents a single-choice control that renders as a toggle group on desktop and switches to a s…
|
|
@@ -39,7 +39,7 @@ Entry point for `@sybilion/uilib`. Open linked AGENT.md before using a component
|
|
|
39
39
|
- [Kicker](src/components/ui/Kicker/AGENT.md) — Kicker is a small eyebrow label rendered above a heading, card, or section. It uses the 12px Manrope label style in s…
|
|
40
40
|
- [Label](src/components/ui/Label/AGENT.md) — Label is the styled form label used across the library. Link it to its control with htmlFor so clicking the label foc…
|
|
41
41
|
- [LabeledInput](src/components/ui/LabeledInput/AGENT.md) — LabeledInput combines a Label and an Input into a single row, wiring the label to the field automatically via the id …
|
|
42
|
-
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId renders
|
|
42
|
+
- [LabelWithId](src/components/ui/LabelWithId/AGENT.md) — LabelWithId always renders the user-facing label. The label span carries `data-analysis-id` so PostHog session replay…
|
|
43
43
|
- [LegacyPlatformLink](src/components/ui/LegacyPlatformLink/AGENT.md) — LegacyPlatformLink is an anchor that points at the legacy platform, building the destination from the API domain plus…
|
|
44
44
|
- [Logo](src/components/ui/Logo/AGENT.md) — Logo renders the brand mark with an optional wordmark. Choose a size that fits the surrounding chrome and hide the te…
|
|
45
45
|
- [MobileAdaptiveSelector](src/components/ui/MobileAdaptiveSelector/AGENT.md) — MobileAdaptiveSelector presents a single-choice control that renders as a toggle group on desktop and switches to a s…
|
|
@@ -183,17 +183,17 @@ function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false
|
|
|
183
183
|
return null;
|
|
184
184
|
return hiddenSeries.has(`forecast_${item.id}`) ? (jsx(EyeClosedIcon, {})) : (jsx(EyeIcon, {}));
|
|
185
185
|
};
|
|
186
|
-
const
|
|
187
|
-
const renderSelectItem = (item) => (jsxs("div", { className: S.selectItemContent, children: [renderItemContent(item), renderIcon(item.icon),
|
|
186
|
+
const renderItemLabel = (item) => (jsx(LabelWithId, { id: item.id, label: isAnalysisInProgressProp(item.status) ? (jsx(TextShimmer, { as: "span", children: item.label })) : (item.label), className: cn(S.label, S.itemLabelWithId) }));
|
|
187
|
+
const renderSelectItem = (item) => (jsxs("div", { className: S.selectItemContent, children: [renderItemContent(item), renderIcon(item.icon), renderItemLabel(item), renderEyeIcon(item)] }));
|
|
188
188
|
if (inlineMode) {
|
|
189
|
-
return (jsxs("div", { className: cn(S.root, S[`variant-${variant}`], selectedItems.length === 1 && S.single, className), children: [selectedItems.map(item => (jsxs("div", { className: cn(S.item, disabled && S.disabled, item.id === -1 && S.historical, item.dimmed && S.dimmed), onClick: () => !disabled && handleItemClick(item), children: [renderIcon(item.icon), renderItemContent(item),
|
|
189
|
+
return (jsxs("div", { className: cn(S.root, S[`variant-${variant}`], selectedItems.length === 1 && S.single, className), children: [selectedItems.map(item => (jsxs("div", { className: cn(S.item, disabled && S.disabled, item.id === -1 && S.historical, item.dimmed && S.dimmed), onClick: () => !disabled && handleItemClick(item), children: [renderIcon(item.icon), renderItemContent(item), renderItemLabel(item)] }, item.id))), unselectedItems.length > 0 && (jsxs(Select, { value: "", onValueChange: handleSelectValue, disabled: disabled, children: [jsx(SelectTrigger, { size: size, variant: variant, className: S.selectTrigger, darker: darker, style: {
|
|
190
190
|
minWidth: 'auto',
|
|
191
191
|
height: 'auto',
|
|
192
192
|
fontSize: 'var(--text-xs)',
|
|
193
193
|
pointerEvents: items.length < 2 && unselectedItems.length === 0
|
|
194
194
|
? 'none'
|
|
195
195
|
: undefined,
|
|
196
|
-
}, children: jsx(SelectValue, { placeholder: selectPlaceholder }) }), jsx(SelectContent, { children: unselectedItems.map(item => (jsx(SelectItem, { value: String(item.id), children: renderSelectItem(item) }, item.id))) })] }))] }));
|
|
196
|
+
}, children: jsx(SelectValue, { placeholder: selectPlaceholder }) }), jsx(SelectContent, { children: unselectedItems.map(item => (jsx(SelectItem, { value: String(item.id), textValue: item.label, children: renderSelectItem(item) }, item.id))) })] }))] }));
|
|
197
197
|
}
|
|
198
198
|
if (items.length === 0)
|
|
199
199
|
return null;
|
|
@@ -229,7 +229,7 @@ function AnalysesSelector({ items, selectedIds, onItemToggle, inlineMode = false
|
|
|
229
229
|
e.preventDefault();
|
|
230
230
|
e.stopPropagation();
|
|
231
231
|
}
|
|
232
|
-
}, children: renamerTriggerContent })) : (jsx(
|
|
232
|
+
}, children: renamerTriggerContent })) : (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))) })] }) }));
|
|
233
233
|
}
|
|
234
234
|
|
|
235
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_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}.
|
|
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","
|
|
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_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","selectTriggerRenamerDisabled":"AnalysesSelector_selectTriggerRenamerDisabled__bA8-G","itemLabelWithId":"AnalysesSelector_itemLabelWithId__8c0mY"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import S from './LabelWithId.styl.js';
|
|
4
4
|
|
|
5
5
|
function LabelWithId({ id, label, className }) {
|
|
6
|
-
return (jsxs("span", { "data-slot": "label-with-id", className: cn(S.root, className), children: [String(id) !== '-1' && jsx("div", { className: S.id, children: id }), " ", label] }));
|
|
6
|
+
return (jsxs("span", { "data-slot": "label-with-id", className: cn(S.root, className), children: [String(id) !== '-1' && jsx("div", { className: S.id, children: id }), jsx("span", { className: S.label, "data-analysis-id": id, children: label })] }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { LabelWithId };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".LabelWithId_root__czAKK{display:inline-block}.LabelWithId_root__czAKK .LabelWithId_id__RDTFH{align-items:center;background-color:var(--muted);border-radius:var(--p-2);display:none;font-size:80%;margin-right:var(--p-1);padding:0 4px}.alt .LabelWithId_root__czAKK .LabelWithId_id__RDTFH{display:inline-flex}";
|
|
4
|
-
var S = {"root":"LabelWithId_root__czAKK","id":"LabelWithId_id__RDTFH"};
|
|
3
|
+
var css_248z = ".LabelWithId_root__czAKK{display:inline-block}.LabelWithId_root__czAKK .LabelWithId_label__sQYx9{display:inline}.LabelWithId_root__czAKK .LabelWithId_id__RDTFH{align-items:center;background-color:var(--muted);border-radius:var(--p-2);display:none;font-size:80%;margin-right:var(--p-1);padding:0 4px}.alt .LabelWithId_root__czAKK .LabelWithId_id__RDTFH{display:inline-flex}";
|
|
4
|
+
var S = {"root":"LabelWithId_root__czAKK","label":"LabelWithId_label__sQYx9","id":"LabelWithId_id__RDTFH"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -30,7 +30,7 @@ function NavUserHeader({ variant, isLoading = false, isAuthenticated, user = nul
|
|
|
30
30
|
.join('');
|
|
31
31
|
return (jsxs(Avatar, { className: S.avatar, children: [jsx(AvatarImage, { src: avatarUrl || undefined, alt: userName }), jsx(AvatarFallback, { children: initials })] }));
|
|
32
32
|
}, [avatarUrl, userName]);
|
|
33
|
-
const userIdentity = useMemo(() => (jsxs("div", { className: S.userInfo, children: [jsx("span", { className: `${S.userName} ph-no-capture`, children: userName }), jsx("span", { className: S.userEmail, children: userEmail })] })), [userEmail, userName]);
|
|
33
|
+
const userIdentity = useMemo(() => (jsxs("div", { className: S.userInfo, children: [jsx("span", { className: `${S.userName} ph-no-capture`, "data-user-name": true, children: userName }), jsx("span", { className: `${S.userEmail} ph-no-capture`, "data-user-email": true, children: userEmail })] })), [userEmail, userName]);
|
|
34
34
|
if (isLoading) {
|
|
35
35
|
return (jsxs(Button, { variant: "ghost", size: "sm", disabled: true, className: S.loadingButton, children: [jsx("div", { className: S.avatarSkeleton }), jsx("div", { className: S.textSkeleton })] }));
|
|
36
36
|
}
|
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
4
4
|
import { useLocation } from 'react-router-dom';
|
|
5
5
|
import { PageContext } from '../pageContext.js';
|
|
6
6
|
import { Scroll } from '@homecode/ui';
|
|
7
7
|
import S from './PageScroll.styl.js';
|
|
8
8
|
|
|
9
|
-
function PageScrollInner({ className, rootClassName, children, }) {
|
|
10
|
-
// const { setIsScrolled } = useContext(PageContext);
|
|
11
|
-
// const prevScrollTop = useRef(0);
|
|
9
|
+
function PageScrollInner({ className, rootClassName, children, scrollInnerRef, onScroll, resetScrollOnPathnameChange, }) {
|
|
12
10
|
const location = useLocation();
|
|
13
|
-
const scrollInnerRef = useRef(null);
|
|
14
11
|
useEffect(() => {
|
|
12
|
+
if (!resetScrollOnPathnameChange)
|
|
13
|
+
return;
|
|
15
14
|
scrollInnerRef.current?.scrollTo({ top: 0 });
|
|
16
|
-
}, [location.pathname]);
|
|
17
|
-
|
|
18
|
-
// if (e.currentTarget.scrollTop > prevScrollTop.current) {
|
|
19
|
-
// // if (e.currentTarget.scrollTop > 0) {
|
|
20
|
-
// setIsScrolled(true);
|
|
21
|
-
// } else {
|
|
22
|
-
// setIsScrolled(false);
|
|
23
|
-
// }
|
|
24
|
-
// prevScrollTop.current = e.currentTarget.scrollTop;
|
|
25
|
-
// };
|
|
26
|
-
return (jsx(Scroll, { y: true,
|
|
27
|
-
// fadeSize="l"
|
|
28
|
-
offset: { y: { before: 120, after: 130 } }, className: cn(S.root, rootClassName), autoHide: true, innerClassName: cn(S.inner, className), yScrollbarClassName: S.scrollbar, onInnerRef: el => {
|
|
15
|
+
}, [location.pathname, resetScrollOnPathnameChange, scrollInnerRef]);
|
|
16
|
+
return (jsx(Scroll, { y: true, offset: { y: { before: 120, after: 130 } }, className: cn(S.root, rootClassName), autoHide: true, innerClassName: cn(S.inner, className), yScrollbarClassName: S.scrollbar, onInnerRef: el => {
|
|
29
17
|
scrollInnerRef.current = el;
|
|
30
|
-
}, children: children }));
|
|
18
|
+
}, onScroll: onScroll, children: children }));
|
|
31
19
|
}
|
|
32
|
-
const PageScroll = ({ children, className, rootClassName, }) => {
|
|
20
|
+
const PageScroll = ({ children, className, rootClassName, scrollInnerRef: scrollInnerRefProp, onScroll, resetScrollOnPathnameChange = true, }) => {
|
|
21
|
+
const internalScrollInnerRef = useRef(null);
|
|
22
|
+
const scrollInnerRef = scrollInnerRefProp ?? internalScrollInnerRef;
|
|
33
23
|
const [isScrolled, setIsScrolled] = useState(false);
|
|
34
|
-
|
|
24
|
+
const pageContextValue = useMemo(() => ({
|
|
25
|
+
isScrolled,
|
|
26
|
+
setIsScrolled,
|
|
27
|
+
getPageScrollElement: () => scrollInnerRef.current,
|
|
28
|
+
}), [isScrolled, scrollInnerRef]);
|
|
29
|
+
return (jsx(PageContext.Provider, { value: pageContextValue, children: jsx(PageScrollInner, { className: className, rootClassName: rootClassName, scrollInnerRef: scrollInnerRef, onScroll: onScroll, resetScrollOnPathnameChange: resetScrollOnPathnameChange, children: children }) }));
|
|
35
30
|
};
|
|
36
31
|
|
|
37
32
|
export { PageScroll };
|
|
@@ -9,10 +9,10 @@ import '../../ui/Button/Button.styl.js';
|
|
|
9
9
|
import '../../ui/Page/AppBanner/AppBanner.styl.js';
|
|
10
10
|
import { InfoIcon } from 'lucide-react';
|
|
11
11
|
import '../../ui/Page/AppShell/AppShell.js';
|
|
12
|
+
import '../../ui/Page/pageContext.js';
|
|
12
13
|
import 'react-router-dom';
|
|
13
14
|
import '../../ui/Sidebar/Sidebar.js';
|
|
14
15
|
import '../../ui/Page/Breadcrumbs/Breadcrumbs.styl.js';
|
|
15
|
-
import '../../ui/Page/pageContext.js';
|
|
16
16
|
import { Tooltip, TooltipTrigger, TooltipContent } from '../../ui/Tooltip/Tooltip.js';
|
|
17
17
|
import '../../ui/Page/PageHeader/PageHeader.styl.js';
|
|
18
18
|
import '../../ui/Page/PageEmptyCanvas/PageEmptyCanvas.styl.js';
|
|
@@ -9,10 +9,10 @@ import { FORECAST_LINE_COLORS } from '../../ui/ChartAreaInteractive/ChartLines.j
|
|
|
9
9
|
import '../../ui/Page/AppBanner/AppBanner.styl.js';
|
|
10
10
|
import 'classnames';
|
|
11
11
|
import '../../ui/Page/AppShell/AppShell.js';
|
|
12
|
+
import '../../ui/Page/pageContext.js';
|
|
12
13
|
import 'react-router-dom';
|
|
13
14
|
import '../../ui/Sidebar/Sidebar.js';
|
|
14
15
|
import '../../ui/Page/Breadcrumbs/Breadcrumbs.styl.js';
|
|
15
|
-
import '../../ui/Page/pageContext.js';
|
|
16
16
|
import '../../ui/Page/PageHeader/PageHeader.styl.js';
|
|
17
17
|
import '../../ui/Page/PageEmptyCanvas/PageEmptyCanvas.styl.js';
|
|
18
18
|
import '../../ui/Page/PageContent/PageContent.styl.js';
|
|
@@ -182,8 +182,20 @@ function extendCustomPerformanceDriftSeedToHistoricalEnd(seed, historicalByDate)
|
|
|
182
182
|
let lastOrigin = dates[dates.length - 1];
|
|
183
183
|
if (!lastOrigin)
|
|
184
184
|
return seed;
|
|
185
|
+
const MAX_MONTH_EXTENSIONS = 500;
|
|
186
|
+
let iterations = 0;
|
|
185
187
|
while (lastOrigin.localeCompare(latest) < 0) {
|
|
188
|
+
iterations += 1;
|
|
189
|
+
if (iterations > MAX_MONTH_EXTENSIONS) {
|
|
190
|
+
console.warn('extendCustomPerformanceDriftSeedToHistoricalEnd: exceeded max month extensions', { lastOrigin, latest });
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
186
193
|
const nextOrigin = norm(getNextMonth(lastOrigin));
|
|
194
|
+
if (nextOrigin === lastOrigin ||
|
|
195
|
+
nextOrigin.localeCompare(lastOrigin) <= 0) {
|
|
196
|
+
console.warn('extendCustomPerformanceDriftSeedToHistoricalEnd: month did not advance', { lastOrigin, nextOrigin, latest });
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
187
199
|
const prevPh = perHorizonDates[perHorizonDates.length - 1];
|
|
188
200
|
const newPh = prevPh.length === horizonCount
|
|
189
201
|
? prevPh.map(d => norm(getNextMonth(norm(d))))
|
package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js
CHANGED
|
@@ -47,7 +47,7 @@ function SidebarDatasetsItemsGrouped({ groupBy, datasets, preItems, postItems, s
|
|
|
47
47
|
return (jsxs(SidebarMenuItem, { children: [jsxs(SidebarMenuButton, { type: "button", isActive: parentActive, onClick: () => toggleGroup(groupName), children: [jsx(PackageOpen, { strokeWidth: 1.5, size: 16 }), jsx(SmartTextTruncate, { children: groupName }), jsx("div", { className: S.chevronContainer, children: isExpanded ? (jsx(ChevronDown, { size: 12 })) : (jsx(ChevronRight, { size: 12 })) })] }), isExpanded && (jsxs(SidebarMenuSub, { className: S.subMenuContainer, children: [jsx("div", { className: S.subMenuBorder }), groupDatasets.map(dataset => (jsx(SidebarMenuSubItem, { className: S.subMenuItem, children: jsx(SidebarMenuSubButton, { href: `#dataset-${dataset.id}`, isActive: dataset.id === selectedDatasetId, onClick: e => {
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
onDatasetClick?.(dataset.id);
|
|
50
|
-
}, children: jsx(SmartTextTruncate, { children: dataset.name }) }) }, dataset.id)))] }))] }, groupName));
|
|
50
|
+
}, children: jsx(SmartTextTruncate, { "data-dataset-id": dataset.id, children: dataset.name }) }) }, dataset.id)))] }))] }, groupName));
|
|
51
51
|
}), postItems] }) }));
|
|
52
52
|
}
|
|
53
53
|
|
package/dist/esm/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export { NavUserHeader } from './components/ui/NavUserHeader/NavUserHeader.js';
|
|
|
72
72
|
export { NumberControl } from './components/ui/NumberControl/NumberControl.js';
|
|
73
73
|
export { AppBanner } from './components/ui/Page/AppBanner/AppBanner.js';
|
|
74
74
|
export { AppShell, AppShellMainContent } from './components/ui/Page/AppShell/AppShell.js';
|
|
75
|
+
export { PageContext } from './components/ui/Page/pageContext.js';
|
|
75
76
|
export { PageHeader } from './components/ui/Page/PageHeader/PageHeader.js';
|
|
76
77
|
export { PageEmptyCanvas } from './components/ui/Page/PageEmptyCanvas/PageEmptyCanvas.js';
|
|
77
78
|
export { PageContent, PageContentSection } from './components/ui/Page/PageContent/PageContent.js';
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export type PageScrollProps = {
|
|
2
3
|
children: React.ReactNode;
|
|
3
4
|
className?: string;
|
|
5
|
+
/** Merged onto the outer Scroll root (e.g. embed previews that must not use `100vh`). */
|
|
4
6
|
rootClassName?: string;
|
|
5
|
-
|
|
7
|
+
/** Optional external ref for the scrollable inner element (e.g. app scroll restoration). */
|
|
8
|
+
scrollInnerRef?: RefObject<HTMLDivElement | null>;
|
|
9
|
+
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
10
|
+
/** When false, pathname changes do not reset scroll (caller owns navigation scroll). */
|
|
11
|
+
resetScrollOnPathnameChange?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const PageScroll: ({ children, className, rootClassName, scrollInnerRef: scrollInnerRefProp, onScroll, resetScrollOnPathnameChange, }: PageScrollProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AppBanner, type AppBannerProps } from './AppBanner/AppBanner';
|
|
2
2
|
export { AppShell, AppShellMainContent, type AppShellMainContentProps, type AppShellProps, } from './AppShell/AppShell';
|
|
3
|
+
export { PageContext } from './pageContext';
|
|
3
4
|
export { PageHeader } from './PageHeader/PageHeader';
|
|
4
5
|
export { PageEmptyCanvas } from './PageEmptyCanvas/PageEmptyCanvas';
|
|
5
6
|
export { PageContent, PageContentSection } from './PageContent/PageContent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -110,28 +110,46 @@ function findLastValidHistoricalChartPoint(historical) {
|
|
|
110
110
|
const validPoints = historical.filter(point => point.historical !== null && point.historical !== undefined);
|
|
111
111
|
return validPoints.length > 0 ? validPoints[validPoints.length - 1] : null;
|
|
112
112
|
}
|
|
113
|
+
function parseYearMonth(date) {
|
|
114
|
+
const datePart = String(date).split(' ')[0] ?? date;
|
|
115
|
+
const match = datePart.match(/^(\d{4})-(\d{1,2})/);
|
|
116
|
+
if (!match) {
|
|
117
|
+
throw new Error(`Invalid date format: ${date}`);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
year: parseInt(match[1], 10),
|
|
121
|
+
month: parseInt(match[2], 10),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function formatMonthStart(year, month) {
|
|
125
|
+
return `${year}-${String(month).padStart(2, '0')}-01`;
|
|
126
|
+
}
|
|
113
127
|
/**
|
|
114
128
|
* Normalize date to first day of month for comparison (YYYY-MM-01)
|
|
115
129
|
*/
|
|
116
130
|
function normalizeToMonthStart(date) {
|
|
117
|
-
const
|
|
118
|
-
return
|
|
131
|
+
const { year, month } = parseYearMonth(date);
|
|
132
|
+
return formatMonthStart(year, month);
|
|
119
133
|
}
|
|
120
134
|
/**
|
|
121
135
|
* Get the previous month date (first day of previous month)
|
|
122
136
|
*/
|
|
123
137
|
function getPreviousMonth(date) {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
const { year, month } = parseYearMonth(date);
|
|
139
|
+
if (month === 1) {
|
|
140
|
+
return formatMonthStart(year - 1, 12);
|
|
141
|
+
}
|
|
142
|
+
return formatMonthStart(year, month - 1);
|
|
127
143
|
}
|
|
128
144
|
/**
|
|
129
145
|
* Get the next month date (first day of next month)
|
|
130
146
|
*/
|
|
131
147
|
function getNextMonth(date) {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
148
|
+
const { year, month } = parseYearMonth(date);
|
|
149
|
+
if (month === 12) {
|
|
150
|
+
return formatMonthStart(year + 1, 1);
|
|
151
|
+
}
|
|
152
|
+
return formatMonthStart(year, month + 1);
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
export { ensureChartForecastBridge, findLastValidHistoricalChartPoint, getNextMonth, getPreviousMonth, normalizeToMonthStart };
|
package/package.json
CHANGED
|
@@ -18,7 +18,6 @@ interface CssExports {
|
|
|
18
18
|
'selectItemContent': string;
|
|
19
19
|
'selectTrigger': string;
|
|
20
20
|
'selectTriggerContent': string;
|
|
21
|
-
'selectTriggerLabelWithId': string;
|
|
22
21
|
'selectTriggerRenamer': string;
|
|
23
22
|
'selectTriggerRenamerDisabled': string;
|
|
24
23
|
'selectTriggerRenaming': string;
|
|
@@ -288,10 +288,9 @@ export function AnalysesSelector({
|
|
|
288
288
|
);
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
const
|
|
291
|
+
const renderItemLabel = (item: AnalysesSelectorItem) => (
|
|
292
292
|
<LabelWithId
|
|
293
|
-
|
|
294
|
-
id={String(item.id)}
|
|
293
|
+
id={item.id}
|
|
295
294
|
label={
|
|
296
295
|
isAnalysisInProgressProp(item.status) ? (
|
|
297
296
|
<TextShimmer as="span">{item.label}</TextShimmer>
|
|
@@ -299,6 +298,7 @@ export function AnalysesSelector({
|
|
|
299
298
|
item.label
|
|
300
299
|
)
|
|
301
300
|
}
|
|
301
|
+
className={cn(S.label, S.itemLabelWithId)}
|
|
302
302
|
/>
|
|
303
303
|
);
|
|
304
304
|
|
|
@@ -306,7 +306,7 @@ export function AnalysesSelector({
|
|
|
306
306
|
<div className={S.selectItemContent}>
|
|
307
307
|
{renderItemContent(item)}
|
|
308
308
|
{renderIcon(item.icon)}
|
|
309
|
-
{
|
|
309
|
+
{renderItemLabel(item)}
|
|
310
310
|
{renderEyeIcon(item)}
|
|
311
311
|
</div>
|
|
312
312
|
);
|
|
@@ -334,7 +334,7 @@ export function AnalysesSelector({
|
|
|
334
334
|
>
|
|
335
335
|
{renderIcon(item.icon)}
|
|
336
336
|
{renderItemContent(item)}
|
|
337
|
-
{
|
|
337
|
+
{renderItemLabel(item)}
|
|
338
338
|
</div>
|
|
339
339
|
))}
|
|
340
340
|
{unselectedItems.length > 0 && (
|
|
@@ -362,7 +362,11 @@ export function AnalysesSelector({
|
|
|
362
362
|
</SelectTrigger>
|
|
363
363
|
<SelectContent>
|
|
364
364
|
{unselectedItems.map(item => (
|
|
365
|
-
<SelectItem
|
|
365
|
+
<SelectItem
|
|
366
|
+
key={item.id}
|
|
367
|
+
value={String(item.id)}
|
|
368
|
+
textValue={item.label}
|
|
369
|
+
>
|
|
366
370
|
{renderSelectItem(item)}
|
|
367
371
|
</SelectItem>
|
|
368
372
|
))}
|
|
@@ -465,11 +469,7 @@ export function AnalysesSelector({
|
|
|
465
469
|
{renamerTriggerContent}
|
|
466
470
|
</div>
|
|
467
471
|
) : (
|
|
468
|
-
<
|
|
469
|
-
className={S.selectTriggerLabelWithId}
|
|
470
|
-
id={selectValue}
|
|
471
|
-
label={<SelectValue placeholder={selectPlaceholder} />}
|
|
472
|
-
/>
|
|
472
|
+
<SelectValue placeholder={selectPlaceholder} />
|
|
473
473
|
)}
|
|
474
474
|
</SelectTrigger>
|
|
475
475
|
<SelectContent>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
LabelWithId renders
|
|
1
|
+
LabelWithId always renders the user-facing label. The label span carries `data-analysis-id` so PostHog session replay `maskTextFn` substitutes the id at capture time (users still see the label). Hold Alt (debug mode via AltKeyProvider) to show an id badge alongside the label — additive debug, not a swap. Passing an id of -1 omits the badge entirely.
|
|
2
2
|
|
|
3
3
|
## When to use
|
|
4
4
|
|
|
5
|
-
- To display
|
|
6
|
-
- In lists, selectors, or breadcrumbs where the
|
|
5
|
+
- To display entity labels (analyses, drivers, etc.) while recording stable ids in PostHog replay.
|
|
6
|
+
- In lists, selectors, or breadcrumbs where the label is user-facing and the id is for analytics/debug only.
|
|
7
7
|
|
|
8
8
|
## When not to use
|
|
9
9
|
|
|
@@ -6,7 +6,10 @@ import type { LabelWithIdProps } from './LabelWithId.types';
|
|
|
6
6
|
export function LabelWithId({ id, label, className }: LabelWithIdProps) {
|
|
7
7
|
return (
|
|
8
8
|
<span data-slot="label-with-id" className={cn(S.root, className)}>
|
|
9
|
-
{String(id) !== '-1' && <div className={S.id}>{id}</div>}
|
|
9
|
+
{String(id) !== '-1' && <div className={S.id}>{id}</div>}
|
|
10
|
+
<span className={S.label} data-analysis-id={id}>
|
|
11
|
+
{label}
|
|
12
|
+
</span>
|
|
10
13
|
</span>
|
|
11
14
|
);
|
|
12
15
|
}
|
|
@@ -69,8 +69,12 @@ export function NavUserHeader({
|
|
|
69
69
|
const userIdentity = useMemo(
|
|
70
70
|
() => (
|
|
71
71
|
<div className={S.userInfo}>
|
|
72
|
-
<span className={`${S.userName} ph-no-capture`}>
|
|
73
|
-
|
|
72
|
+
<span className={`${S.userName} ph-no-capture`} data-user-name>
|
|
73
|
+
{userName}
|
|
74
|
+
</span>
|
|
75
|
+
<span className={`${S.userEmail} ph-no-capture`} data-user-email>
|
|
76
|
+
{userEmail}
|
|
77
|
+
</span>
|
|
74
78
|
</div>
|
|
75
79
|
),
|
|
76
80
|
[userEmail, userName],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { type RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import { PageContext } from '#uilib/components/ui/Page/pageContext';
|
|
@@ -7,39 +7,43 @@ import { Scroll } from '@homecode/ui';
|
|
|
7
7
|
|
|
8
8
|
import S from './PageScroll.styl';
|
|
9
9
|
|
|
10
|
+
export type PageScrollProps = {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Merged onto the outer Scroll root (e.g. embed previews that must not use `100vh`). */
|
|
14
|
+
rootClassName?: string;
|
|
15
|
+
/** Optional external ref for the scrollable inner element (e.g. app scroll restoration). */
|
|
16
|
+
scrollInnerRef?: RefObject<HTMLDivElement | null>;
|
|
17
|
+
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
18
|
+
/** When false, pathname changes do not reset scroll (caller owns navigation scroll). */
|
|
19
|
+
resetScrollOnPathnameChange?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
10
22
|
function PageScrollInner({
|
|
11
23
|
className,
|
|
12
24
|
rootClassName,
|
|
13
25
|
children,
|
|
26
|
+
scrollInnerRef,
|
|
27
|
+
onScroll,
|
|
28
|
+
resetScrollOnPathnameChange,
|
|
14
29
|
}: {
|
|
15
30
|
className?: string;
|
|
16
|
-
/** Merged onto the outer Scroll root (e.g. embed previews that must not use `100vh`). */
|
|
17
31
|
rootClassName?: string;
|
|
18
32
|
children: React.ReactNode;
|
|
33
|
+
scrollInnerRef: RefObject<HTMLDivElement | null>;
|
|
34
|
+
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
35
|
+
resetScrollOnPathnameChange: boolean;
|
|
19
36
|
}) {
|
|
20
|
-
// const { setIsScrolled } = useContext(PageContext);
|
|
21
|
-
// const prevScrollTop = useRef(0);
|
|
22
37
|
const location = useLocation();
|
|
23
|
-
const scrollInnerRef = useRef<HTMLDivElement | null>(null);
|
|
24
38
|
|
|
25
39
|
useEffect(() => {
|
|
40
|
+
if (!resetScrollOnPathnameChange) return;
|
|
26
41
|
scrollInnerRef.current?.scrollTo({ top: 0 });
|
|
27
|
-
}, [location.pathname]);
|
|
28
|
-
|
|
29
|
-
// const onScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
|
30
|
-
// if (e.currentTarget.scrollTop > prevScrollTop.current) {
|
|
31
|
-
// // if (e.currentTarget.scrollTop > 0) {
|
|
32
|
-
// setIsScrolled(true);
|
|
33
|
-
// } else {
|
|
34
|
-
// setIsScrolled(false);
|
|
35
|
-
// }
|
|
36
|
-
// prevScrollTop.current = e.currentTarget.scrollTop;
|
|
37
|
-
// };
|
|
42
|
+
}, [location.pathname, resetScrollOnPathnameChange, scrollInnerRef]);
|
|
38
43
|
|
|
39
44
|
return (
|
|
40
45
|
<Scroll
|
|
41
46
|
y
|
|
42
|
-
// fadeSize="l"
|
|
43
47
|
offset={{ y: { before: 120, after: 130 } }}
|
|
44
48
|
className={cn(S.root, rootClassName)}
|
|
45
49
|
autoHide
|
|
@@ -48,7 +52,7 @@ function PageScrollInner({
|
|
|
48
52
|
onInnerRef={el => {
|
|
49
53
|
scrollInnerRef.current = el;
|
|
50
54
|
}}
|
|
51
|
-
|
|
55
|
+
onScroll={onScroll}
|
|
52
56
|
>
|
|
53
57
|
{children}
|
|
54
58
|
</Scroll>
|
|
@@ -59,16 +63,32 @@ export const PageScroll = ({
|
|
|
59
63
|
children,
|
|
60
64
|
className,
|
|
61
65
|
rootClassName,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
scrollInnerRef: scrollInnerRefProp,
|
|
67
|
+
onScroll,
|
|
68
|
+
resetScrollOnPathnameChange = true,
|
|
69
|
+
}: PageScrollProps) => {
|
|
70
|
+
const internalScrollInnerRef = useRef<HTMLDivElement | null>(null);
|
|
71
|
+
const scrollInnerRef = scrollInnerRefProp ?? internalScrollInnerRef;
|
|
67
72
|
const [isScrolled, setIsScrolled] = useState(false);
|
|
68
73
|
|
|
74
|
+
const pageContextValue = useMemo(
|
|
75
|
+
() => ({
|
|
76
|
+
isScrolled,
|
|
77
|
+
setIsScrolled,
|
|
78
|
+
getPageScrollElement: () => scrollInnerRef.current,
|
|
79
|
+
}),
|
|
80
|
+
[isScrolled, scrollInnerRef],
|
|
81
|
+
);
|
|
82
|
+
|
|
69
83
|
return (
|
|
70
|
-
<PageContext.Provider value={
|
|
71
|
-
<PageScrollInner
|
|
84
|
+
<PageContext.Provider value={pageContextValue}>
|
|
85
|
+
<PageScrollInner
|
|
86
|
+
className={className}
|
|
87
|
+
rootClassName={rootClassName}
|
|
88
|
+
scrollInnerRef={scrollInnerRef}
|
|
89
|
+
onScroll={onScroll}
|
|
90
|
+
resetScrollOnPathnameChange={resetScrollOnPathnameChange}
|
|
91
|
+
>
|
|
72
92
|
{children}
|
|
73
93
|
</PageScrollInner>
|
|
74
94
|
</PageContext.Provider>
|
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
type AppShellMainContentProps,
|
|
6
6
|
type AppShellProps,
|
|
7
7
|
} from './AppShell/AppShell';
|
|
8
|
+
export { PageContext } from './pageContext';
|
|
8
9
|
export { PageHeader } from './PageHeader/PageHeader';
|
|
9
10
|
export { PageEmptyCanvas } from './PageEmptyCanvas/PageEmptyCanvas';
|
|
10
11
|
export { PageContent, PageContentSection } from './PageContent/PageContent';
|
|
@@ -3,7 +3,9 @@ import { createContext } from 'react';
|
|
|
3
3
|
export const PageContext = createContext<{
|
|
4
4
|
isScrolled: boolean;
|
|
5
5
|
setIsScrolled: (isScrolled: boolean) => void;
|
|
6
|
+
getPageScrollElement: () => HTMLDivElement | null;
|
|
6
7
|
}>({
|
|
7
8
|
isScrolled: false,
|
|
8
9
|
setIsScrolled: () => {},
|
|
10
|
+
getPageScrollElement: () => null,
|
|
9
11
|
});
|
|
@@ -266,8 +266,31 @@ export function extendCustomPerformanceDriftSeedToHistoricalEnd(
|
|
|
266
266
|
let lastOrigin = dates[dates.length - 1];
|
|
267
267
|
if (!lastOrigin) return seed;
|
|
268
268
|
|
|
269
|
+
const MAX_MONTH_EXTENSIONS = 500;
|
|
270
|
+
let iterations = 0;
|
|
271
|
+
|
|
269
272
|
while (lastOrigin.localeCompare(latest) < 0) {
|
|
273
|
+
iterations += 1;
|
|
274
|
+
if (iterations > MAX_MONTH_EXTENSIONS) {
|
|
275
|
+
console.warn(
|
|
276
|
+
'extendCustomPerformanceDriftSeedToHistoricalEnd: exceeded max month extensions',
|
|
277
|
+
{ lastOrigin, latest },
|
|
278
|
+
);
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
|
|
270
282
|
const nextOrigin = norm(getNextMonth(lastOrigin));
|
|
283
|
+
if (
|
|
284
|
+
nextOrigin === lastOrigin ||
|
|
285
|
+
nextOrigin.localeCompare(lastOrigin) <= 0
|
|
286
|
+
) {
|
|
287
|
+
console.warn(
|
|
288
|
+
'extendCustomPerformanceDriftSeedToHistoricalEnd: month did not advance',
|
|
289
|
+
{ lastOrigin, nextOrigin, latest },
|
|
290
|
+
);
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
|
|
271
294
|
const prevPh = perHorizonDates[perHorizonDates.length - 1];
|
|
272
295
|
const newPh =
|
|
273
296
|
prevPh.length === horizonCount
|
|
@@ -131,7 +131,9 @@ export function SidebarDatasetsItemsGrouped({
|
|
|
131
131
|
onDatasetClick?.(dataset.id);
|
|
132
132
|
}}
|
|
133
133
|
>
|
|
134
|
-
<SmartTextTruncate
|
|
134
|
+
<SmartTextTruncate data-dataset-id={dataset.id}>
|
|
135
|
+
{dataset.name}
|
|
136
|
+
</SmartTextTruncate>
|
|
135
137
|
</SidebarMenuSubButton>
|
|
136
138
|
</SidebarMenuSubItem>
|
|
137
139
|
))}
|
|
@@ -187,12 +187,28 @@ export function isSameMonth(date1: string, date2: string): boolean {
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
function parseYearMonth(date: string): { year: number; month: number } {
|
|
191
|
+
const datePart = String(date).split(' ')[0] ?? date;
|
|
192
|
+
const match = datePart.match(/^(\d{4})-(\d{1,2})/);
|
|
193
|
+
if (!match) {
|
|
194
|
+
throw new Error(`Invalid date format: ${date}`);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
year: parseInt(match[1], 10),
|
|
198
|
+
month: parseInt(match[2], 10),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function formatMonthStart(year: number, month: number): string {
|
|
203
|
+
return `${year}-${String(month).padStart(2, '0')}-01`;
|
|
204
|
+
}
|
|
205
|
+
|
|
190
206
|
/**
|
|
191
207
|
* Normalize date to first day of month for comparison (YYYY-MM-01)
|
|
192
208
|
*/
|
|
193
209
|
export function normalizeToMonthStart(date: string): string {
|
|
194
|
-
const
|
|
195
|
-
return
|
|
210
|
+
const { year, month } = parseYearMonth(date);
|
|
211
|
+
return formatMonthStart(year, month);
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
/**
|
|
@@ -225,18 +241,22 @@ export function findLatestForecastDate(
|
|
|
225
241
|
* Get the previous month date (first day of previous month)
|
|
226
242
|
*/
|
|
227
243
|
export function getPreviousMonth(date: string): string {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
const { year, month } = parseYearMonth(date);
|
|
245
|
+
if (month === 1) {
|
|
246
|
+
return formatMonthStart(year - 1, 12);
|
|
247
|
+
}
|
|
248
|
+
return formatMonthStart(year, month - 1);
|
|
231
249
|
}
|
|
232
250
|
|
|
233
251
|
/**
|
|
234
252
|
* Get the next month date (first day of next month)
|
|
235
253
|
*/
|
|
236
254
|
export function getNextMonth(date: string): string {
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
255
|
+
const { year, month } = parseYearMonth(date);
|
|
256
|
+
if (month === 12) {
|
|
257
|
+
return formatMonthStart(year + 1, 1);
|
|
258
|
+
}
|
|
259
|
+
return formatMonthStart(year, month + 1);
|
|
240
260
|
}
|
|
241
261
|
|
|
242
262
|
/**
|