@carlonicora/nextjs-jsonapi 2.0.1 → 2.0.2

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.
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- var _chunkR666YQGQjs = require('../../chunk-R666YQGQ.js');
29
+ var _chunkQS5Y6ZBFjs = require('../../chunk-QS5Y6ZBF.js');
30
30
  require('../../chunk-UXJAS6C5.js');
31
31
 
32
32
 
@@ -64,7 +64,7 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
64
64
  };
65
65
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-center gap-2", children: [
66
66
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
67
- _chunkR666YQGQjs.DateRangeSelector,
67
+ _chunkQS5Y6ZBFjs.DateRangeSelector,
68
68
  {
69
69
  onDateChange: (range) => {
70
70
  if (!_optionalChain([range, 'optionalAccess', _ => _.from]) || !_optionalChain([range, 'optionalAccess', _2 => _2.to])) return;
@@ -99,16 +99,16 @@ function TokenUsageAdminFilterBar({ granularity, companyId, metric, companies, o
99
99
  }
100
100
  ),
101
101
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
102
- _chunkR666YQGQjs.Select,
102
+ _chunkQS5Y6ZBFjs.Select,
103
103
  {
104
104
  items: companyItems,
105
105
  value: _nullishCoalesce(companyId, () => ( ALL_COMPANIES)),
106
106
  onValueChange: (value) => onChange({ companyId: !value || value === ALL_COMPANIES ? void 0 : value }),
107
107
  children: [
108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
109
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.SelectContent, { children: [
110
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
111
- companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectItem, { value: company.id, children: company.label }, company.id))
108
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectTrigger, { className: "w-56", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectValue, { placeholder: t("token_usage.admin.all_companies") }) }),
109
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.SelectContent, { children: [
110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value: ALL_COMPANIES, children: t("token_usage.admin.all_companies") }),
111
+ companies.map((company) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value: company.id, children: company.label }, company.id))
112
112
  ] })
113
113
  ]
114
114
  }
@@ -131,7 +131,7 @@ function Segmented({
131
131
  children: options.map((option) => {
132
132
  const selected = option.value === value;
133
133
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
134
- _chunkR666YQGQjs.Button,
134
+ _chunkQS5Y6ZBFjs.Button,
135
135
  {
136
136
  type: "button",
137
137
  size: "sm",
@@ -212,7 +212,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
212
212
  topN = DEFAULT_TOP_N
213
213
  }) => {
214
214
  const t = _nextintl.useTranslations.call(void 0, );
215
- const generateUrl = _chunkR666YQGQjs.usePageUrlGenerator.call(void 0, );
215
+ const generateUrl = _chunkQS5Y6ZBFjs.usePageUrlGenerator.call(void 0, );
216
216
  const [filters, setFilterState] = _react.useState.call(void 0, () => {
217
217
  const range = defaultRange();
218
218
  return {
@@ -330,7 +330,7 @@ var TokenUsageAdminProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
330
330
  error
331
331
  ]
332
332
  );
333
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
333
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminContext.Provider, { value: contextValue, children }) });
334
334
  }, "TokenUsageAdminProvider");
335
335
  var useTokenUsageAdmin = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
336
336
  const ctx = _react.useContext.call(void 0, TokenUsageAdminContext);
@@ -458,7 +458,7 @@ function LeadTile({
458
458
  delta,
459
459
  previousLabel
460
460
  }) {
461
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.CardContent, { className: "grid gap-1", children: [
461
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { className: "grid gap-1", children: [
462
462
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
463
463
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-primary text-xl font-semibold tabular-nums", children: value }),
464
464
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
@@ -474,7 +474,7 @@ function SupportingTile({
474
474
  value,
475
475
  delta
476
476
  }) {
477
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.CardContent, { className: "grid gap-1", children: [
477
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { "data-testid": testId, size: "sm", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { className: "grid gap-1", children: [
478
478
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: label }),
479
479
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-2", children: [
480
480
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium tabular-nums", children: value }),
@@ -566,8 +566,8 @@ function TokenUsageBreakdownTable({ rows, metric }) {
566
566
  // The package's <Table> wraps itself in an `overflow-x-clip` container, which
567
567
  // would swallow the overflow before this scroller ever saw it — hence the
568
568
  // child override. Wide metric tables must scroll, never widen the page.
569
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Table, { children: [
570
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableHead, { className: _chunkDS4IBFWAjs.cn.call(void 0, column.numeric && "text-right"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
569
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-x-auto [&_[data-slot=table-container]]:overflow-x-visible", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Table, { children: [
570
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableRow, { children: columns.map((column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableHead, { className: _chunkDS4IBFWAjs.cn.call(void 0, column.numeric && "text-right"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
571
571
  "button",
572
572
  {
573
573
  type: "button",
@@ -582,20 +582,20 @@ function TokenUsageBreakdownTable({ rows, metric }) {
582
582
  ]
583
583
  }
584
584
  ) }, column.key)) }) }),
585
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableBody, { children: sortedRows.map((row) => {
585
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableBody, { children: sortedRows.map((row) => {
586
586
  const value = metricValue(row, metric);
587
587
  const share = total > 0 ? value / total * 100 : 0;
588
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
589
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
590
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
591
- showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : formatDecimal(row.activeUsers, 0) }),
592
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.calls, 0) }),
593
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensIn, 0) }),
594
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensOut, 0) }),
595
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(cacheHitPercentage(row.cached, row.tokensIn)) }),
596
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.cost, "cost") }),
597
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.credits, "credits") }),
598
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(share) })
588
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.TableRow, { "data-testid": `breakdown-row-${row.id}`, children: [
589
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-xs", children: row.id === "other" ? t("token_usage.admin.other") : row.label }),
590
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-muted-foreground text-xs", children: _nullishCoalesce(row.sublabel, () => ( "")) }),
591
+ showActiveUsers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: row.activeUsers === void 0 ? "" : formatDecimal(row.activeUsers, 0) }),
592
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.calls, 0) }),
593
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensIn, 0) }),
594
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatDecimal(row.tokensOut, 0) }),
595
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(cacheHitPercentage(row.cached, row.tokensIn)) }),
596
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.cost, "cost") }),
597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatMetricValue(row.credits, "credits") }),
598
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.TableCell, { className: "text-right text-xs tabular-nums", children: formatPercent(share) })
599
599
  ] }, row.id);
600
600
  }) })
601
601
  ] }) })
@@ -789,7 +789,7 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
789
789
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className, children: [
790
790
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-data", children: JSON.stringify(chartData) }),
791
791
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", "data-testid": "timeline-series", children: JSON.stringify(seriesKeys) }),
792
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
792
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.ChartContainer, { config: chartConfig, className: "aspect-auto h-72 w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _recharts.BarChart, { accessibilityLayer: true, data: chartData, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
793
793
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _recharts.CartesianGrid, { vertical: false }),
794
794
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
795
795
  _recharts.XAxis,
@@ -813,17 +813,17 @@ function TokenUsageTimelineChart({ rows, metric, stackBy, className }) {
813
813
  }
814
814
  ),
815
815
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
816
- _chunkR666YQGQjs.ChartTooltip,
816
+ _chunkQS5Y6ZBFjs.ChartTooltip,
817
817
  {
818
818
  content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
819
- _chunkR666YQGQjs.ChartTooltipContent,
819
+ _chunkQS5Y6ZBFjs.ChartTooltipContent,
820
820
  {
821
821
  labelFormatter: (value) => formatBucket.format(/* @__PURE__ */ new Date(`${String(value)}T00:00:00.000Z`))
822
822
  }
823
823
  )
824
824
  }
825
825
  ),
826
- seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.ChartLegendContent, {}) }) : null,
826
+ seriesKeys.length >= 2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.ChartLegend, { content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.ChartLegendContent, {}) }) : null,
827
827
  seriesKeys.map((series, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
828
828
  _recharts.Bar,
829
829
  {
@@ -869,19 +869,19 @@ function TokenUsageAdminContainer() {
869
869
  [t]
870
870
  );
871
871
  if (error) {
872
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
872
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) }) }) }) });
873
873
  }
874
- if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
874
+ if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true });
875
875
  const emptyLabel = t("token_usage.admin.no_data");
876
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
876
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.RoundPageContainer, { fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-4 p-4", children: [
877
877
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageAdminTiles, { summary, metric: filters.metric, singleCustomerMode }),
878
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
879
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.CardHeader, { children: [
880
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
881
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
878
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
879
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: [
880
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.usage_over_time") }),
881
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardAction, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
882
882
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("token_usage.admin.stack_by") }),
883
883
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
884
- _chunkR666YQGQjs.Select,
884
+ _chunkQS5Y6ZBFjs.Select,
885
885
  {
886
886
  items: stackByItems,
887
887
  value: filters.stackBy,
@@ -889,29 +889,29 @@ function TokenUsageAdminContainer() {
889
889
  if (value) setFilters({ stackBy: value });
890
890
  },
891
891
  children: [
892
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectValue, {}) }),
893
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.SelectItem, { value, children: stackByItems[value] }, value)) })
892
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectTrigger, { size: "sm", className: "w-36", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectValue, {}) }),
893
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectContent, { children: STACK_BY_VALUES.map((value) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.SelectItem, { value, children: stackByItems[value] }, value)) })
894
894
  ]
895
895
  }
896
896
  )
897
897
  ] }) })
898
898
  ] }),
899
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
899
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageTimelineChart, { rows: timeline, metric: filters.metric, stackBy: filters.stackBy }) })
900
900
  ] }),
901
901
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid gap-4 md:grid-cols-2", children: [
902
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
903
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
904
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
902
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
903
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.by_company") }) }),
904
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byCompany, metric: filters.metric, emptyLabel }) })
905
905
  ] }),
906
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
907
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
908
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
906
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
907
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.by_user") }) }),
908
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageRankedBar, { rows: byUser, metric: filters.metric, emptyLabel }) })
909
909
  ] })
910
910
  ] }),
911
911
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkDS4IBFWAjs.cn.call(void 0, "grid gap-4", !singleCustomerMode && "md:grid-cols-2"), children: [
912
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
913
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
914
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
912
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
913
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.customer_by_operation") }) }),
914
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
915
915
  TokenUsageRankedBar,
916
916
  {
917
917
  rows: byCustomerOperation,
@@ -921,9 +921,9 @@ function TokenUsageAdminContainer() {
921
921
  }
922
922
  ) })
923
923
  ] }),
924
- !singleCustomerMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
925
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
926
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
924
+ !singleCustomerMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
925
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.platform_by_operation") }) }),
926
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
927
927
  TokenUsageRankedBar,
928
928
  {
929
929
  rows: byOperation,
@@ -934,9 +934,9 @@ function TokenUsageAdminContainer() {
934
934
  ) })
935
935
  ] })
936
936
  ] }),
937
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR666YQGQjs.Card, { children: [
938
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
939
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR666YQGQjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
937
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQS5Y6ZBFjs.Card, { children: [
938
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardTitle, { children: t("token_usage.admin.detail") }) }),
939
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQS5Y6ZBFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenUsageBreakdownTable, { rows: byCompany, metric: filters.metric }) })
940
940
  ] })
941
941
  ] }) });
942
942
  }
@@ -26,7 +26,7 @@ import {
26
26
  TableHeader,
27
27
  TableRow,
28
28
  usePageUrlGenerator
29
- } from "../../chunk-RVGBVVRD.mjs";
29
+ } from "../../chunk-TESVH5PV.mjs";
30
30
  import "../../chunk-HN5ED7OF.mjs";
31
31
  import {
32
32
  AbstractService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlonicora/nextjs-jsonapi",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Next.js JSON:API client with server/client support and caching",
5
5
  "author": "Carlo Nicora",
6
6
  "license": "GPL-3.0-or-later",
@@ -510,7 +510,20 @@ export function RoundPageContainer({
510
510
  // `flex-col` + a separate scroll body below: the header must stay
511
511
  // put while the panel content scrolls. Scrolling on this element
512
512
  // (as it did before) would carry the header away with the content.
513
- "flex h-full shrink-0 flex-col overflow-hidden transition-all duration-300 ease-in-out",
513
+ //
514
+ // `relative` is load-bearing: the panel content mounts Base UI
515
+ // dialog headers marked `sr-only`, which are `position: absolute`
516
+ // with no offsets. Without a positioned ancestor their containing
517
+ // block is the initial containing block, so when the panel is
518
+ // collapsed (`w-0`) their static position lands a few px past the
519
+ // viewport's right edge and adds to the DOCUMENT's scroll area —
520
+ // `overflow-hidden` here cannot clip them, because it only clips
521
+ // descendants whose containing block is inside this element. That
522
+ // produced a page-wide horizontal scrollbar, which in turn stole
523
+ // 15px of height and made every `100vh`/`100svh` box overflow
524
+ // vertically too. Making this the containing block lets
525
+ // `overflow-hidden` clip them again.
526
+ "relative flex h-full shrink-0 flex-col overflow-hidden transition-all duration-300 ease-in-out",
514
527
  showDetails ? "w-96 border-l opacity-100" : "ml-0 w-0 border-l-0 opacity-0",
515
528
  )}
516
529
  >
@@ -21,9 +21,22 @@ function Command({ className, ...props }: React.ComponentProps<typeof CommandPri
21
21
  );
22
22
  }
23
23
 
24
+ /**
25
+ * `title` / `description` render a visually hidden header **inside** the popup, for command
26
+ * dialogs whose own content carries no `DialogTitle`. Omit both when `children` already render
27
+ * a `DialogTitle` — Base UI keeps a single `titleElementId` per dialog
28
+ * (`store.useSyncedValueWithCleanup('titleElementId', id)`), so two mounted titles fight over
29
+ * the popup's `aria-labelledby` and unmount order decides which one wins.
30
+ *
31
+ * The header must stay inside `DialogContent`. Rendered as a sibling of it (as shadcn upstream
32
+ * does) it is NOT portalled: it lands inline in the page, and because `sr-only` is
33
+ * `position: absolute` with no offsets and usually no positioned ancestor, its static position
34
+ * can fall outside the viewport and grow the DOCUMENT's scroll area — a stray page-wide
35
+ * scrollbar with no visible cause. See the `relative` note in RoundPageContainer.
36
+ */
24
37
  function CommandDialog({
25
- title = "Command Palette",
26
- description = "Search for a command to run...",
38
+ title,
39
+ description,
27
40
  children,
28
41
  className,
29
42
  showCloseButton = false,
@@ -37,11 +50,13 @@ function CommandDialog({
37
50
  }) {
38
51
  return (
39
52
  <Dialog {...props}>
40
- <DialogHeader className="sr-only">
41
- <DialogTitle>{title}</DialogTitle>
42
- <DialogDescription>{description}</DialogDescription>
43
- </DialogHeader>
44
53
  <DialogContent className={cn("rounded-xl! p-0 overflow-hidden p-0", className)} showCloseButton={showCloseButton}>
54
+ {(title || description) && (
55
+ <DialogHeader className="sr-only">
56
+ {title && <DialogTitle>{title}</DialogTitle>}
57
+ {description && <DialogDescription>{description}</DialogDescription>}
58
+ </DialogHeader>
59
+ )}
45
60
  {children}
46
61
  </DialogContent>
47
62
  </Dialog>