@timefoldai/viz-react 0.0.0 → 0.1.0

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 (288) hide show
  1. package/README.md +239 -1
  2. package/dist/THIRD-PARTY-NOTICES.txt +99 -0
  3. package/dist/a11y/AccessibleTable.d.mts +42 -0
  4. package/dist/a11y/AccessibleTable.mjs +82 -0
  5. package/dist/a11y/activation.d.mts +4 -0
  6. package/dist/a11y/activation.mjs +0 -0
  7. package/dist/analytics/AnalyticsProvider.d.mts +16 -0
  8. package/dist/analytics/AnalyticsProvider.mjs +32 -0
  9. package/dist/assets/Inter-latin-ext.woff2 +0 -0
  10. package/dist/badge/Badge.css +122 -0
  11. package/dist/badge/Badge.d.mts +50 -0
  12. package/dist/badge/Badge.mjs +145 -0
  13. package/dist/badge/Badge.module.css.mjs +15 -0
  14. package/dist/badge/BadgeFacetGroup.d.mts +23 -0
  15. package/dist/badge/BadgeFacetGroup.mjs +220 -0
  16. package/dist/badge/BadgeGroup.d.mts +13 -0
  17. package/dist/badge/BadgeGroup.mjs +53 -0
  18. package/dist/badge/BadgeList.d.mts +14 -0
  19. package/dist/badge/BadgeList.mjs +15 -0
  20. package/dist/badge/badge-facet-fit.d.mts +18 -0
  21. package/dist/badge/badge-facet-fit.mjs +50 -0
  22. package/dist/badge/badge-item.d.mts +19 -0
  23. package/dist/badge/badge-item.mjs +23 -0
  24. package/dist/button/CopyButton.d.mts +12 -0
  25. package/dist/button/CopyButton.mjs +52 -0
  26. package/dist/button/ShowAllButton.d.mts +14 -0
  27. package/dist/button/ShowAllButton.mjs +61 -0
  28. package/dist/button/ShowMoreButton.d.mts +13 -0
  29. package/dist/button/ShowMoreButton.mjs +51 -0
  30. package/dist/button/SolveButton.d.mts +16 -0
  31. package/dist/button/SolveButton.mjs +56 -0
  32. package/dist/charts/BarChart.css +59 -0
  33. package/dist/charts/BarChart.d.mts +26 -0
  34. package/dist/charts/BarChart.mjs +167 -0
  35. package/dist/charts/BarChart.module.css.mjs +10 -0
  36. package/dist/charts/ChartGrid.d.mts +8 -0
  37. package/dist/charts/ChartGrid.mjs +47 -0
  38. package/dist/charts/DistributionChart.d.mts +60 -0
  39. package/dist/charts/DistributionChart.mjs +151 -0
  40. package/dist/code/CodeBlock.d.mts +13 -0
  41. package/dist/code/CodeBlock.mjs +71 -0
  42. package/dist/composition-bar/CompositionBar.d.mts +24 -0
  43. package/dist/composition-bar/CompositionBar.mjs +124 -0
  44. package/dist/composition-bar/composition-shares.d.mts +8 -0
  45. package/dist/composition-bar/composition-shares.mjs +30 -0
  46. package/dist/data-gate/DataGate.d.mts +34 -0
  47. package/dist/data-gate/DataGate.mjs +80 -0
  48. package/dist/date-scope/DateScope.d.mts +30 -0
  49. package/dist/date-scope/DateScope.mjs +285 -0
  50. package/dist/design-system/part-props.d.mts +39 -0
  51. package/dist/design-system/part-props.mjs +0 -0
  52. package/dist/detail-panel/DetailPanel.d.mts +22 -0
  53. package/dist/detail-panel/DetailPanel.mjs +80 -0
  54. package/dist/detail-panel/DetailPanelSection.d.mts +20 -0
  55. package/dist/detail-panel/DetailPanelSection.mjs +27 -0
  56. package/dist/detail-panel/micro-label.d.mts +7 -0
  57. package/dist/detail-panel/micro-label.mjs +9 -0
  58. package/dist/env.d.mts +2 -0
  59. package/dist/env.mjs +4 -0
  60. package/dist/export/ExportCsvButton.d.mts +19 -0
  61. package/dist/export/ExportCsvButton.mjs +73 -0
  62. package/dist/export/download-csv.d.mts +5 -0
  63. package/dist/export/download-csv.mjs +11 -0
  64. package/dist/export/download-file.d.mts +11 -0
  65. package/dist/export/download-file.mjs +32 -0
  66. package/dist/export/download-json.d.mts +2 -0
  67. package/dist/export/download-json.mjs +8 -0
  68. package/dist/filter/FilterGroup.d.mts +24 -0
  69. package/dist/filter/FilterGroup.mjs +71 -0
  70. package/dist/filter/FilterGroupTitle.d.mts +3 -0
  71. package/dist/filter/FilterGroupTitle.mjs +18 -0
  72. package/dist/filter/FilterItem.d.mts +17 -0
  73. package/dist/filter/FilterItem.mjs +94 -0
  74. package/dist/filter/FilterPanel.d.mts +22 -0
  75. package/dist/filter/FilterPanel.mjs +158 -0
  76. package/dist/filter/FilterToggleButton.d.mts +15 -0
  77. package/dist/filter/FilterToggleButton.mjs +30 -0
  78. package/dist/filter/date-range.d.mts +8 -0
  79. package/dist/filter/date-range.mjs +13 -0
  80. package/dist/filter/filter-facet.d.mts +7 -0
  81. package/dist/filter/filter-facet.mjs +0 -0
  82. package/dist/heatmap/Heatmap.css +138 -0
  83. package/dist/heatmap/Heatmap.d.mts +10 -0
  84. package/dist/heatmap/Heatmap.mjs +370 -0
  85. package/dist/heatmap/Heatmap.module.css.mjs +17 -0
  86. package/dist/heatmap/HeatmapCell.d.mts +25 -0
  87. package/dist/heatmap/HeatmapCell.mjs +124 -0
  88. package/dist/heatmap/heatmap-scale.d.mts +19 -0
  89. package/dist/heatmap/heatmap-scale.mjs +43 -0
  90. package/dist/heatmap/heatmap-types.d.mts +49 -0
  91. package/dist/heatmap/heatmap-types.mjs +0 -0
  92. package/dist/hooks/use-controllable-state.d.mts +9 -0
  93. package/dist/hooks/use-controllable-state.mjs +44 -0
  94. package/dist/hooks/use-debounced-value.d.mts +1 -0
  95. package/dist/hooks/use-debounced-value.mjs +27 -0
  96. package/dist/hooks/use-detail-panel-layout.d.mts +18 -0
  97. package/dist/hooks/use-detail-panel-layout.mjs +94 -0
  98. package/dist/hooks/use-hover-card.d.mts +47 -0
  99. package/dist/hooks/use-hover-card.mjs +190 -0
  100. package/dist/hooks/use-hover-focus-card.d.mts +38 -0
  101. package/dist/hooks/use-hover-focus-card.mjs +321 -0
  102. package/dist/hooks/use-hover-intent.d.mts +6 -0
  103. package/dist/hooks/use-hover-intent.mjs +55 -0
  104. package/dist/hooks/use-merged-ref.d.mts +2 -0
  105. package/dist/hooks/use-merged-ref.mjs +36 -0
  106. package/dist/hooks/use-tracked-anchor.d.mts +14 -0
  107. package/dist/hooks/use-tracked-anchor.mjs +42 -0
  108. package/dist/index.d.mts +97 -0
  109. package/dist/index.mjs +88 -0
  110. package/dist/input/MenuButton.d.mts +47 -0
  111. package/dist/input/MenuButton.mjs +152 -0
  112. package/dist/interval-strip/IntervalStrip.css +7 -0
  113. package/dist/interval-strip/IntervalStrip.d.mts +39 -0
  114. package/dist/interval-strip/IntervalStrip.mjs +233 -0
  115. package/dist/interval-strip/IntervalStrip.module.css.mjs +4 -0
  116. package/dist/interval-strip/IntervalStripAxis.d.mts +18 -0
  117. package/dist/interval-strip/IntervalStripAxis.mjs +73 -0
  118. package/dist/interval-strip/interval-fill.d.mts +2 -0
  119. package/dist/interval-strip/interval-fill.mjs +13 -0
  120. package/dist/interval-strip/interval-layout.d.mts +33 -0
  121. package/dist/interval-strip/interval-layout.mjs +79 -0
  122. package/dist/layout/AppShell.css +103 -0
  123. package/dist/layout/AppShell.d.mts +73 -0
  124. package/dist/layout/AppShell.mjs +397 -0
  125. package/dist/layout/AppShell.module.css.mjs +16 -0
  126. package/dist/layout/ColorSchemeMenu.d.mts +14 -0
  127. package/dist/layout/ColorSchemeMenu.mjs +92 -0
  128. package/dist/layout/DemoDataPicker.d.mts +17 -0
  129. package/dist/layout/DemoDataPicker.mjs +150 -0
  130. package/dist/layout/OverflowMenu.d.mts +11 -0
  131. package/dist/layout/OverflowMenu.mjs +94 -0
  132. package/dist/layout/SidebarLayout.css +70 -0
  133. package/dist/layout/SidebarLayout.d.mts +33 -0
  134. package/dist/layout/SidebarLayout.mjs +129 -0
  135. package/dist/layout/SidebarLayout.module.css.mjs +8 -0
  136. package/dist/layout/use-date-scope-day.d.mts +23 -0
  137. package/dist/layout/use-date-scope-day.mjs +63 -0
  138. package/dist/layout/use-fill-height.d.mts +7 -0
  139. package/dist/layout/use-fill-height.mjs +50 -0
  140. package/dist/layout/use-followed-state.d.mts +5 -0
  141. package/dist/layout/use-followed-state.mjs +75 -0
  142. package/dist/layout/use-page-route.d.mts +10 -0
  143. package/dist/layout/use-page-route.mjs +65 -0
  144. package/dist/legend/Legend.d.mts +54 -0
  145. package/dist/legend/Legend.mjs +132 -0
  146. package/dist/map/MapLayersControl.d.mts +11 -0
  147. package/dist/map/MapLayersControl.mjs +157 -0
  148. package/dist/map/MapLocator.css +9 -0
  149. package/dist/map/MapLocator.d.mts +18 -0
  150. package/dist/map/MapLocator.mjs +97 -0
  151. package/dist/map/MapLocator.module.css.mjs +4 -0
  152. package/dist/map/MapMarker.d.mts +29 -0
  153. package/dist/map/MapMarker.mjs +265 -0
  154. package/dist/map/MapStops.d.mts +19 -0
  155. package/dist/map/MapStops.mjs +355 -0
  156. package/dist/map/MapView.css +24 -0
  157. package/dist/map/MapView.d.mts +11 -0
  158. package/dist/map/MapView.mjs +141 -0
  159. package/dist/map/MapWebgl.d.mts +9 -0
  160. package/dist/map/MapWebgl.mjs +727 -0
  161. package/dist/map/area-layers.d.mts +33 -0
  162. package/dist/map/area-layers.mjs +96 -0
  163. package/dist/map/control-group.d.mts +6 -0
  164. package/dist/map/control-group.mjs +12 -0
  165. package/dist/map/for-each-chunk.d.mts +4 -0
  166. package/dist/map/for-each-chunk.mjs +14 -0
  167. package/dist/map/highlight.d.mts +30 -0
  168. package/dist/map/highlight.mjs +99 -0
  169. package/dist/map/locator-tile.d.mts +24 -0
  170. package/dist/map/locator-tile.mjs +41 -0
  171. package/dist/map/map-sites.d.mts +12 -0
  172. package/dist/map/map-sites.mjs +39 -0
  173. package/dist/map/map-style.d.mts +24 -0
  174. package/dist/map/map-style.mjs +79 -0
  175. package/dist/map/marker-geometry.d.mts +5 -0
  176. package/dist/map/marker-geometry.mjs +13 -0
  177. package/dist/map/marker-icon.d.mts +26 -0
  178. package/dist/map/marker-icon.mjs +223 -0
  179. package/dist/map/observe-color-scheme.d.mts +5 -0
  180. package/dist/map/observe-color-scheme.mjs +19 -0
  181. package/dist/map/popup-placement.d.mts +20 -0
  182. package/dist/map/popup-placement.mjs +20 -0
  183. package/dist/map/route-layers.d.mts +28 -0
  184. package/dist/map/route-layers.mjs +73 -0
  185. package/dist/map/types.d.mts +97 -0
  186. package/dist/map/types.mjs +0 -0
  187. package/dist/map/use-painted-color-scheme.d.mts +6 -0
  188. package/dist/map/use-painted-color-scheme.mjs +43 -0
  189. package/dist/map/use-resolved-colors.d.mts +5 -0
  190. package/dist/map/use-resolved-colors.mjs +63 -0
  191. package/dist/pagination/paginationLabels.d.mts +6 -0
  192. package/dist/pagination/paginationLabels.mjs +8 -0
  193. package/dist/popover/Popover.css +176 -0
  194. package/dist/popover/Popover.d.mts +239 -0
  195. package/dist/popover/Popover.mjs +672 -0
  196. package/dist/popover/Popover.module.css.mjs +18 -0
  197. package/dist/popover/PopoverFacts.d.mts +24 -0
  198. package/dist/popover/PopoverFacts.mjs +63 -0
  199. package/dist/readout/Readout.d.mts +15 -0
  200. package/dist/readout/Readout.mjs +53 -0
  201. package/dist/readout/TimeZoneReadout.d.mts +11 -0
  202. package/dist/readout/TimeZoneReadout.mjs +46 -0
  203. package/dist/score-box/ScoreBox.css +62 -0
  204. package/dist/score-box/ScoreBox.d.mts +12 -0
  205. package/dist/score-box/ScoreBox.mjs +143 -0
  206. package/dist/score-box/ScoreBox.module.css.mjs +15 -0
  207. package/dist/segment-bar/Segment.d.mts +23 -0
  208. package/dist/segment-bar/Segment.mjs +27 -0
  209. package/dist/segment-bar/SegmentBar.css +44 -0
  210. package/dist/segment-bar/SegmentBar.d.mts +35 -0
  211. package/dist/segment-bar/SegmentBar.mjs +57 -0
  212. package/dist/segment-bar/SegmentBar.module.css.mjs +9 -0
  213. package/dist/segment-bar/segment-box.d.mts +10 -0
  214. package/dist/segment-bar/segment-box.mjs +30 -0
  215. package/dist/stat/Stat.d.mts +25 -0
  216. package/dist/stat/Stat.mjs +36 -0
  217. package/dist/stat/StatTile.d.mts +18 -0
  218. package/dist/stat/StatTile.mjs +37 -0
  219. package/dist/styles.css +1 -0
  220. package/dist/swatch/Swatch.d.mts +8 -0
  221. package/dist/swatch/Swatch.mjs +30 -0
  222. package/dist/swatch/legend-swatch.d.mts +3 -0
  223. package/dist/swatch/legend-swatch.mjs +0 -0
  224. package/dist/tab-bar/FilteredTabBar.d.mts +32 -0
  225. package/dist/tab-bar/FilteredTabBar.mjs +181 -0
  226. package/dist/tab-bar/TabBar.d.mts +22 -0
  227. package/dist/tab-bar/TabBar.mjs +151 -0
  228. package/dist/tab-bar/TabPanel.d.mts +9 -0
  229. package/dist/tab-bar/TabPanel.mjs +55 -0
  230. package/dist/tab-bar/assert-named-value.d.mts +4 -0
  231. package/dist/tab-bar/assert-named-value.mjs +6 -0
  232. package/dist/table/DataTable.d.mts +31 -0
  233. package/dist/table/DataTable.mjs +43 -0
  234. package/dist/theme/use-color-scheme.d.mts +14 -0
  235. package/dist/theme/use-color-scheme.mjs +92 -0
  236. package/dist/theme.css +58 -0
  237. package/dist/timeline/Timeline.d.mts +54 -0
  238. package/dist/timeline/Timeline.mjs +220 -0
  239. package/dist/timeline/TimelineBand.d.mts +18 -0
  240. package/dist/timeline/TimelineBand.mjs +30 -0
  241. package/dist/timeline/TimelineGroup.d.mts +7 -0
  242. package/dist/timeline/TimelineGroup.mjs +50 -0
  243. package/dist/timeline/TimelineItem.d.mts +19 -0
  244. package/dist/timeline/TimelineItem.mjs +64 -0
  245. package/dist/timeline/TimelineItemChip.css +153 -0
  246. package/dist/timeline/TimelineItemChip.d.mts +23 -0
  247. package/dist/timeline/TimelineItemChip.mjs +74 -0
  248. package/dist/timeline/TimelineItemChip.module.css.mjs +15 -0
  249. package/dist/timeline/TimelineItemMark.css +38 -0
  250. package/dist/timeline/TimelineItemMark.d.mts +15 -0
  251. package/dist/timeline/TimelineItemMark.mjs +129 -0
  252. package/dist/timeline/TimelineItemMark.module.css.mjs +4 -0
  253. package/dist/timeline/TimelineRoot.d.mts +19 -0
  254. package/dist/timeline/TimelineRoot.mjs +742 -0
  255. package/dist/timeline/TimelineRowHeader.d.mts +23 -0
  256. package/dist/timeline/TimelineRowHeader.mjs +244 -0
  257. package/dist/timeline/TimelineZoomHint.d.mts +9 -0
  258. package/dist/timeline/TimelineZoomHint.mjs +32 -0
  259. package/dist/timeline/axis-label.d.mts +5 -0
  260. package/dist/timeline/axis-label.mjs +53 -0
  261. package/dist/timeline/batched-dataset-writer.d.mts +29 -0
  262. package/dist/timeline/batched-dataset-writer.mjs +58 -0
  263. package/dist/timeline/row-card-side.d.mts +7 -0
  264. package/dist/timeline/row-card-side.mjs +6 -0
  265. package/dist/timeline/timeline-a11y.d.mts +33 -0
  266. package/dist/timeline/timeline-a11y.mjs +96 -0
  267. package/dist/timeline/timeline-context.d.mts +33 -0
  268. package/dist/timeline/timeline-context.mjs +40 -0
  269. package/dist/timeline/timeline-types.d.mts +126 -0
  270. package/dist/timeline/timeline-types.mjs +0 -0
  271. package/dist/timeline/timeline-utils.d.mts +52 -0
  272. package/dist/timeline/timeline-utils.mjs +130 -0
  273. package/dist/timeline/zoom-modifier.d.mts +21 -0
  274. package/dist/timeline/zoom-modifier.mjs +25 -0
  275. package/dist/toast/ToastProvider.d.mts +33 -0
  276. package/dist/toast/ToastProvider.mjs +257 -0
  277. package/dist/toast/toast-context.d.mts +2 -0
  278. package/dist/toast/toast-context.mjs +5 -0
  279. package/dist/tokens.css +1 -0
  280. package/dist/tooltip/Tooltip.d.mts +17 -0
  281. package/dist/tooltip/Tooltip.mjs +41 -0
  282. package/dist/tooltip/hover-open-delay.d.mts +2 -0
  283. package/dist/tooltip/hover-open-delay.mjs +4 -0
  284. package/dist/tooltip/is-text-cut.d.mts +1 -0
  285. package/dist/tooltip/is-text-cut.mjs +5 -0
  286. package/dist/vendor/components.d.mts +664 -0
  287. package/dist/vendor/components.mjs +2060 -0
  288. package/package.json +56 -5
@@ -0,0 +1,285 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useMemo } from "react";
5
+ import { Button, DateField, DateRangeField } from "../vendor/components.mjs";
6
+ import clsx$1 from "clsx";
7
+ import { MAX_SCOPE_DAYS, OVERLAY_ATTRIBUTE, canStepRange, rangeLength, stepDay, stepRange } from "@timefoldai/viz-core";
8
+ import { TbChevronLeft, TbChevronRight } from "react-icons/tb";
9
+ // src/date-scope/DateScope.tsx
10
+ const LOCALE = "en-GB";
11
+ const NO_DATES = "No dates";
12
+ const CALENDAR_PROPS = { [OVERLAY_ATTRIBUTE]: "" };
13
+ function Stepper(t0) {
14
+ const $ = c(25);
15
+ let canStep;
16
+ let children;
17
+ let className;
18
+ let label;
19
+ let onStep;
20
+ let root;
21
+ let stepUnit;
22
+ if ($[0] !== t0) {
23
+ ({label, stepUnit, canStep, onStep, children, className, ...root} = t0);
24
+ $[0] = t0;
25
+ $[1] = canStep;
26
+ $[2] = children;
27
+ $[3] = className;
28
+ $[4] = label;
29
+ $[5] = onStep;
30
+ $[6] = root;
31
+ $[7] = stepUnit;
32
+ } else {
33
+ canStep = $[1];
34
+ children = $[2];
35
+ className = $[3];
36
+ label = $[4];
37
+ onStep = $[5];
38
+ root = $[6];
39
+ stepUnit = $[7];
40
+ }
41
+ let t1;
42
+ if ($[8] !== canStep || $[9] !== onStep || $[10] !== stepUnit) {
43
+ t1 = (direction) => /* @__PURE__ */ jsx(Button, {
44
+ type: "button",
45
+ "aria-label": `${direction === 1 ? "Next" : "Previous"} ${stepUnit}`,
46
+ disabled: !canStep(direction),
47
+ onClick: () => onStep(direction),
48
+ variant: "soft",
49
+ soloIcon: direction === 1 ? TbChevronRight : TbChevronLeft
50
+ });
51
+ $[8] = canStep;
52
+ $[9] = onStep;
53
+ $[10] = stepUnit;
54
+ $[11] = t1;
55
+ } else t1 = $[11];
56
+ const stepButton = t1;
57
+ const t2 = `${label} shown`;
58
+ let t3;
59
+ if ($[12] !== className) {
60
+ t3 = clsx$1("inline-flex items-center gap-2", className);
61
+ $[12] = className;
62
+ $[13] = t3;
63
+ } else t3 = $[13];
64
+ let t4;
65
+ if ($[14] !== stepButton) {
66
+ t4 = stepButton(-1);
67
+ $[14] = stepButton;
68
+ $[15] = t4;
69
+ } else t4 = $[15];
70
+ let t5;
71
+ if ($[16] !== stepButton) {
72
+ t5 = stepButton(1);
73
+ $[16] = stepButton;
74
+ $[17] = t5;
75
+ } else t5 = $[17];
76
+ let t6;
77
+ if ($[18] !== children || $[19] !== root || $[20] !== t2 || $[21] !== t3 || $[22] !== t4 || $[23] !== t5) {
78
+ t6 = /* @__PURE__ */ jsxs("div", {
79
+ ...root,
80
+ role: "group",
81
+ "aria-label": t2,
82
+ "data-slot": "date-scope",
83
+ className: t3,
84
+ children: [
85
+ t4,
86
+ children,
87
+ t5
88
+ ]
89
+ });
90
+ $[18] = children;
91
+ $[19] = root;
92
+ $[20] = t2;
93
+ $[21] = t3;
94
+ $[22] = t4;
95
+ $[23] = t5;
96
+ $[24] = t6;
97
+ } else t6 = $[24];
98
+ return t6;
99
+ }
100
+ function useWithoutData(dataDays) {
101
+ return useMemo(() => {
102
+ if (!dataDays) return void 0;
103
+ let days;
104
+ return (day) => !(days ??= dataDays()).has(day);
105
+ }, [dataDays]);
106
+ }
107
+ function rangeStepUnit(value) {
108
+ if (!value) return "days";
109
+ const length = rangeLength(value);
110
+ return length === 1 ? "day" : `${length} days`;
111
+ }
112
+ function RangeScope(t0) {
113
+ const $ = c(22);
114
+ const { bounds, dataDays, value, onValueChange, className, style, ref } = t0;
115
+ const withoutData = useWithoutData(dataDays);
116
+ let t1;
117
+ if ($[0] !== value) {
118
+ t1 = rangeStepUnit(value);
119
+ $[0] = value;
120
+ $[1] = t1;
121
+ } else t1 = $[1];
122
+ let t2;
123
+ if ($[2] !== bounds || $[3] !== value) {
124
+ t2 = (direction) => !!bounds && !!value && canStepRange(value, direction, bounds);
125
+ $[2] = bounds;
126
+ $[3] = value;
127
+ $[4] = t2;
128
+ } else t2 = $[4];
129
+ let t3;
130
+ if ($[5] !== bounds || $[6] !== onValueChange || $[7] !== value) {
131
+ t3 = (direction_0) => {
132
+ if (bounds && value) onValueChange(stepRange(value, direction_0, bounds));
133
+ };
134
+ $[5] = bounds;
135
+ $[6] = onValueChange;
136
+ $[7] = value;
137
+ $[8] = t3;
138
+ } else t3 = $[8];
139
+ let t4;
140
+ if ($[9] !== bounds || $[10] !== onValueChange || $[11] !== value || $[12] !== withoutData) {
141
+ t4 = bounds === null ? /* @__PURE__ */ jsx(DateField, {
142
+ "aria-label": "Days",
143
+ "data-slot": "date-scope-field",
144
+ width: "content",
145
+ value: null,
146
+ placeholder: NO_DATES,
147
+ disabled: true
148
+ }) : /* @__PURE__ */ jsx(DateRangeField, {
149
+ "aria-label": "Days",
150
+ "data-slot": "date-scope-field",
151
+ width: "fixed",
152
+ locale: LOCALE,
153
+ calendarProps: CALENDAR_PROPS,
154
+ value,
155
+ onValueChange: (range) => range && onValueChange(range),
156
+ min: bounds?.min,
157
+ max: bounds?.max,
158
+ maxDays: MAX_SCOPE_DAYS,
159
+ isDateDisabled: withoutData,
160
+ disabled: !bounds
161
+ });
162
+ $[9] = bounds;
163
+ $[10] = onValueChange;
164
+ $[11] = value;
165
+ $[12] = withoutData;
166
+ $[13] = t4;
167
+ } else t4 = $[13];
168
+ let t5;
169
+ if ($[14] !== className || $[15] !== ref || $[16] !== style || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4) {
170
+ t5 = /* @__PURE__ */ jsx(Stepper, {
171
+ className,
172
+ style,
173
+ ref,
174
+ label: "Days",
175
+ stepUnit: t1,
176
+ canStep: t2,
177
+ onStep: t3,
178
+ children: t4
179
+ });
180
+ $[14] = className;
181
+ $[15] = ref;
182
+ $[16] = style;
183
+ $[17] = t1;
184
+ $[18] = t2;
185
+ $[19] = t3;
186
+ $[20] = t4;
187
+ $[21] = t5;
188
+ } else t5 = $[21];
189
+ return t5;
190
+ }
191
+ function DayScope(t0) {
192
+ const $ = c(23);
193
+ const { bounds, value, onValueChange, className, style, ref } = t0;
194
+ let t1;
195
+ if ($[0] !== bounds || $[1] !== value) {
196
+ t1 = (direction) => !!bounds && !!value && stepDay(value, direction, bounds) !== value;
197
+ $[0] = bounds;
198
+ $[1] = value;
199
+ $[2] = t1;
200
+ } else t1 = $[2];
201
+ let t2;
202
+ if ($[3] !== bounds || $[4] !== onValueChange || $[5] !== value) {
203
+ t2 = (direction_0) => {
204
+ if (bounds && value) onValueChange(stepDay(value, direction_0, bounds));
205
+ };
206
+ $[3] = bounds;
207
+ $[4] = onValueChange;
208
+ $[5] = value;
209
+ $[6] = t2;
210
+ } else t2 = $[6];
211
+ const t3 = bounds === null ? null : value;
212
+ const t4 = bounds === null ? NO_DATES : void 0;
213
+ let t5;
214
+ if ($[7] !== onValueChange) {
215
+ t5 = (day) => day && onValueChange(day);
216
+ $[7] = onValueChange;
217
+ $[8] = t5;
218
+ } else t5 = $[8];
219
+ const t6 = bounds?.min;
220
+ const t7 = bounds?.max;
221
+ const t8 = !bounds;
222
+ let t9;
223
+ if ($[9] !== t3 || $[10] !== t4 || $[11] !== t5 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8) {
224
+ t9 = /* @__PURE__ */ jsx(DateField, {
225
+ "aria-label": "Day",
226
+ "data-slot": "date-scope-field",
227
+ width: "fixed",
228
+ weekday: "short",
229
+ locale: LOCALE,
230
+ calendarProps: CALENDAR_PROPS,
231
+ value: t3,
232
+ placeholder: t4,
233
+ onValueChange: t5,
234
+ min: t6,
235
+ max: t7,
236
+ disabled: t8
237
+ });
238
+ $[9] = t3;
239
+ $[10] = t4;
240
+ $[11] = t5;
241
+ $[12] = t6;
242
+ $[13] = t7;
243
+ $[14] = t8;
244
+ $[15] = t9;
245
+ } else t9 = $[15];
246
+ let t10;
247
+ if ($[16] !== className || $[17] !== ref || $[18] !== style || $[19] !== t1 || $[20] !== t2 || $[21] !== t9) {
248
+ t10 = /* @__PURE__ */ jsx(Stepper, {
249
+ className,
250
+ style,
251
+ ref,
252
+ label: "Day",
253
+ stepUnit: "day",
254
+ canStep: t1,
255
+ onStep: t2,
256
+ children: t9
257
+ });
258
+ $[16] = className;
259
+ $[17] = ref;
260
+ $[18] = style;
261
+ $[19] = t1;
262
+ $[20] = t2;
263
+ $[21] = t9;
264
+ $[22] = t10;
265
+ } else t10 = $[22];
266
+ return t10;
267
+ }
268
+ /**
269
+ * Steps the days a page shows with previous and next buttons around a date field with a calendar.
270
+ * Range mode caps a pick at seven days; day mode moves one day at a time.
271
+ *
272
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/
273
+ * @category Controls
274
+ */
275
+ function DateScope(props) {
276
+ const $ = c(2);
277
+ let t0;
278
+ if ($[0] !== props) {
279
+ t0 = props.mode === "range" ? /* @__PURE__ */ jsx(RangeScope, { ...props }) : /* @__PURE__ */ jsx(DayScope, { ...props });
280
+ $[0] = props;
281
+ $[1] = t0;
282
+ } else t0 = $[1];
283
+ return t0;
284
+ }
285
+ export { DateScope as default };
@@ -0,0 +1,39 @@
1
+ import { SlotIcon } from "../vendor/components.mjs";
2
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3
+ /** A dropdown menu item's look: `destructive` for an irreversible action such as delete. */
4
+ export type DropdownMenuItemVariant = "default" | "destructive";
5
+ /** The props of `DropdownMenuItem`: the Radix item props, its icons, its look and its current choice. */
6
+ export interface DropdownMenuItemProps extends React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Item> {
7
+ leadingIcon?: SlotIcon;
8
+ trailingIcon?: SlotIcon;
9
+ /** @defaultValue "default" */
10
+ variant?: DropdownMenuItemVariant;
11
+ selected?: boolean;
12
+ }
13
+ /** The props of `Pagination`: the current page of `pageCount`, its labels and the page change. */
14
+ export interface PaginationProps extends Omit<React.ComponentPropsWithRef<"nav">, "onChange"> {
15
+ current: number;
16
+ pageCount: number;
17
+ onPageChange: (page: number) => void;
18
+ previousLabel: string;
19
+ nextLabel: string;
20
+ pageLabel: (page: number) => string;
21
+ }
22
+ /** The width of a search field: `full` fills the container, `content` fits its value. */
23
+ export type SearchInputWidth = "full" | "content";
24
+ /** The props of `SearchInput`: the input props, its width and the props of its wrapping `div`. */
25
+ export interface SearchInputProps extends Omit<React.ComponentPropsWithRef<"input">, "width"> {
26
+ /** @defaultValue "full" */
27
+ width?: SearchInputWidth;
28
+ containerProps?: React.ComponentPropsWithoutRef<"div">;
29
+ }
30
+ /** A table's look: `plain` keeps only the frame and semantics, so the table lays out its own cells. */
31
+ export type TableVariant = "default" | "plain";
32
+ /** The props of `Table`: the table props, the props of its scroll container, its border and its look. */
33
+ export interface TableProps extends React.ComponentPropsWithRef<"table"> {
34
+ containerProps?: React.ComponentPropsWithRef<"div">;
35
+ /** @defaultValue true */
36
+ bordered?: boolean;
37
+ /** @defaultValue "default" */
38
+ variant?: TableVariant;
39
+ }
File without changes
@@ -0,0 +1,22 @@
1
+ import { DetailPanelPlacement } from "../hooks/use-detail-panel-layout.mjs";
2
+ /** The props of `DetailPanel`: whether it is open and the content it shows. */
3
+ export interface DetailPanelProps extends Pick<React.ComponentProps<"div">, "className" | "style" | "ref"> {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ title: React.ReactNode;
7
+ placement: DetailPanelPlacement;
8
+ /** @defaultValue "right" */
9
+ side?: "left" | "right";
10
+ /** @defaultValue false */
11
+ initialFocus?: boolean;
12
+ finalFocus?: React.RefObject<HTMLElement | null>;
13
+ children: React.ReactNode;
14
+ }
15
+ /**
16
+ * A detail surface for a selected item, beside or over the chart it belongs to.
17
+ * Model-agnostic — placement/side are typed props, exposed as `data-placement`/`data-side`.
18
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
19
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/region.html
20
+ * @category Overlays
21
+ */
22
+ export default function DetailPanel({ open, onOpenChange, title, placement, side, initialFocus, finalFocus, children, className, style, ref }: DetailPanelProps): import("react").JSX.Element | null;
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { useMergedRef } from "../hooks/use-merged-ref.mjs";
3
+ import Tooltip$1 from "../tooltip/Tooltip.mjs";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useId, useRef } from "react";
6
+ import { Button } from "../vendor/components.mjs";
7
+ import clsx$1 from "clsx";
8
+ import { TbX } from "react-icons/tb";
9
+ // src/detail-panel/DetailPanel.tsx
10
+ /**
11
+ * A detail surface for a selected item, beside or over the chart it belongs to.
12
+ * Model-agnostic — placement/side are typed props, exposed as `data-placement`/`data-side`.
13
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
14
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/region.html
15
+ * @category Overlays
16
+ */
17
+ function DetailPanel({ open, onOpenChange, title, placement, side = "right", initialFocus = false, finalFocus, children, className, style, ref }) {
18
+ const titleId = useId();
19
+ const panelRef = useRef(null);
20
+ const rootRef = useMergedRef(panelRef, ref);
21
+ const wasOpen = useRef(false);
22
+ const latest = useRef({
23
+ onOpenChange,
24
+ initialFocus,
25
+ finalFocus
26
+ });
27
+ useEffect(() => {
28
+ latest.current = {
29
+ onOpenChange,
30
+ initialFocus,
31
+ finalFocus
32
+ };
33
+ });
34
+ useEffect(() => {
35
+ if (!open) {
36
+ if (wasOpen.current) {
37
+ wasOpen.current = false;
38
+ latest.current.finalFocus?.current?.focus();
39
+ }
40
+ return;
41
+ }
42
+ wasOpen.current = true;
43
+ if (latest.current.initialFocus) panelRef.current?.focus();
44
+ function onKeyDown(event) {
45
+ if (event.key === "Escape") latest.current.onOpenChange(false);
46
+ }
47
+ document.addEventListener("keydown", onKeyDown);
48
+ return () => document.removeEventListener("keydown", onKeyDown);
49
+ }, [open]);
50
+ if (!open) return null;
51
+ return /* @__PURE__ */ jsxs("div", {
52
+ ref: rootRef,
53
+ style,
54
+ tabIndex: -1,
55
+ role: placement === "inline" ? "region" : "dialog",
56
+ "aria-labelledby": titleId,
57
+ "data-slot": "detail-panel",
58
+ "data-placement": placement,
59
+ "data-side": side,
60
+ className: clsx$1("border-border bg-background flex flex-none flex-col gap-3.5 overflow-y-auto rounded-[0.375rem] border p-4", placement === "inline" && "w-[var(--viz-detail-panel-width)]", placement !== "inline" && "shadow-3 absolute top-0 z-[5] max-h-full", placement === "overlay" && "w-[var(--viz-detail-panel-width-overlay)]", placement === "overlay" && (side === "right" ? "right-0" : "left-0"), placement === "sheet" && "inset-x-0", className),
61
+ children: [/* @__PURE__ */ jsxs("div", {
62
+ className: "flex items-center justify-between gap-2",
63
+ children: [/* @__PURE__ */ jsx("h3", {
64
+ id: titleId,
65
+ className: clsx$1("m-0 font-semibold", placement === "inline" ? "text-base" : "text-sm"),
66
+ children: title
67
+ }), /* @__PURE__ */ jsx(Tooltip$1, {
68
+ label: "Close",
69
+ children: /* @__PURE__ */ jsx(Button, {
70
+ "data-slot": "detail-panel-close",
71
+ variant: "ghost",
72
+ "aria-label": "Close",
73
+ soloIcon: TbX,
74
+ onClick: () => onOpenChange(false)
75
+ })
76
+ })]
77
+ }), children]
78
+ });
79
+ }
80
+ export { DetailPanel as default };
@@ -0,0 +1,20 @@
1
+ import { DetailPanelSize } from "./micro-label.mjs";
2
+ /** The props of `DetailPanelSection`: its label and its size. */
3
+ export interface DetailPanelSectionProps extends React.ComponentProps<"div"> {
4
+ label: React.ReactNode;
5
+ /** @defaultValue false */
6
+ ruled?: boolean;
7
+ /** @defaultValue "md" */
8
+ size?: DetailPanelSize;
9
+ children: React.ReactNode;
10
+ }
11
+ /**
12
+ * One labelled block of a detail panel: an uppercase micro label over its
13
+ * children, optionally opened by a hairline.
14
+ *
15
+ * @remarks
16
+ * Identity for tests and consumers is `data-slot="detail-panel-section"` and `data-slot="detail-panel-section-label"`.
17
+ *
18
+ * @category Data display
19
+ */
20
+ export default function DetailPanelSection({ label, ruled, size, children, className, ...props }: DetailPanelSectionProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { microLabel } from "./micro-label.mjs";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import clsx$1 from "clsx";
4
+ // src/detail-panel/DetailPanelSection.tsx
5
+ /**
6
+ * One labelled block of a detail panel: an uppercase micro label over its
7
+ * children, optionally opened by a hairline.
8
+ *
9
+ * @remarks
10
+ * Identity for tests and consumers is `data-slot="detail-panel-section"` and `data-slot="detail-panel-section-label"`.
11
+ *
12
+ * @category Data display
13
+ */
14
+ function DetailPanelSection({ label, ruled = false, size = "md", children, className, ...props }) {
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ "data-slot": "detail-panel-section",
17
+ "data-size": size,
18
+ className: clsx$1("border-border flex flex-col", ruled && "border-t pt-3", className),
19
+ ...props,
20
+ children: [/* @__PURE__ */ jsx("div", {
21
+ "data-slot": "detail-panel-section-label",
22
+ className: clsx$1("flex justify-between pb-1 font-semibold uppercase", microLabel(size)),
23
+ children: label
24
+ }), children]
25
+ });
26
+ }
27
+ export { DetailPanelSection as default };
@@ -0,0 +1,7 @@
1
+ /** The density of a detail panel's labels and figures: `sm` for a floating panel, `md` for the inline column. */
2
+ export type DetailPanelSize = "sm" | "md";
3
+ /**
4
+ * The uppercase micro label a detail panel wears over a section or a
5
+ * figure, shared by `DetailPanelSection` and `Stat` so the two cannot drift.
6
+ */
7
+ export declare function microLabel(size: DetailPanelSize): "text-[0.625rem] tracking-[0.05em]" | "text-[0.6875rem] tracking-[0.09em]";
@@ -0,0 +1,9 @@
1
+ // src/detail-panel/micro-label.ts
2
+ /**
3
+ * The uppercase micro label a detail panel wears over a section or a
4
+ * figure, shared by `DetailPanelSection` and `Stat` so the two cannot drift.
5
+ */
6
+ function microLabel(size) {
7
+ return size === "sm" ? "text-[0.625rem] tracking-[0.05em]" : "text-[0.6875rem] tracking-[0.09em]";
8
+ }
9
+ export { microLabel };
package/dist/env.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ /** True in a Vite dev or test build; false in a production build and under a bundler that defines no `import.meta.env`. */
2
+ export declare const isDevBuild: boolean;
package/dist/env.mjs ADDED
@@ -0,0 +1,4 @@
1
+ // src/env.ts
2
+ /** True in a Vite dev or test build; false in a production build and under a bundler that defines no `import.meta.env`. */
3
+ const isDevBuild = typeof import.meta.env !== "undefined" && import.meta.env.DEV === true;
4
+ export { isDevBuild };
@@ -0,0 +1,19 @@
1
+ import { DataTableColumn } from "../table/DataTable.mjs";
2
+ /** The props of `ExportCsvButton`: the rows and columns it exports and the base name of the file. */
3
+ export interface ExportCsvButtonProps<T> {
4
+ rows: T[];
5
+ columns: DataTableColumn<T>[];
6
+ baseName: string;
7
+ }
8
+ /**
9
+ * Exports a table's rows as a CSV download, reusing the very column
10
+ * config the table renders so the export cannot drift from the view.
11
+ *
12
+ * @remarks
13
+ * Disabled when there is nothing to export (no rows, or no column
14
+ * declares a `value`), so it never hands the user an empty file.
15
+ *
16
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
17
+ * @category Controls
18
+ */
19
+ export default function ExportCsvButton<T>({ rows, columns, baseName }: ExportCsvButtonProps<T>): import("react").JSX.Element;
@@ -0,0 +1,73 @@
1
+ "use client";
2
+ import { downloadCsv } from "./download-csv.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Button } from "../vendor/components.mjs";
6
+ import { toCsv } from "@timefoldai/viz-core";
7
+ import { TbDownload } from "react-icons/tb";
8
+ import { title } from "radash";
9
+ // src/export/ExportCsvButton.tsx
10
+ /**
11
+ * Exports a table's rows as a CSV download, reusing the very column
12
+ * config the table renders so the export cannot drift from the view.
13
+ *
14
+ * @remarks
15
+ * Disabled when there is nothing to export (no rows, or no column
16
+ * declares a `value`), so it never hands the user an empty file.
17
+ *
18
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
19
+ * @category Controls
20
+ */
21
+ function ExportCsvButton(t0) {
22
+ const $ = c(10);
23
+ const { rows, columns, baseName } = t0;
24
+ let t1;
25
+ if ($[0] !== columns) {
26
+ t1 = columns.flatMap(_temp);
27
+ $[0] = columns;
28
+ $[1] = t1;
29
+ } else t1 = $[1];
30
+ const exportable = t1;
31
+ let t2;
32
+ if ($[2] !== baseName || $[3] !== exportable || $[4] !== rows) {
33
+ t2 = function handleClick() {
34
+ downloadCsv(toCsv(rows, exportable), baseName);
35
+ };
36
+ $[2] = baseName;
37
+ $[3] = exportable;
38
+ $[4] = rows;
39
+ $[5] = t2;
40
+ } else t2 = $[5];
41
+ const handleClick = t2;
42
+ const t3 = rows.length === 0 || exportable.length === 0;
43
+ let t4;
44
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
45
+ t4 = /* @__PURE__ */ jsx("span", {
46
+ "data-slot": "export-csv-button-label",
47
+ children: "Download CSV"
48
+ });
49
+ $[6] = t4;
50
+ } else t4 = $[6];
51
+ let t5;
52
+ if ($[7] !== handleClick || $[8] !== t3) {
53
+ t5 = /* @__PURE__ */ jsx(Button, {
54
+ type: "button",
55
+ variant: "soft",
56
+ leadingIcon: TbDownload,
57
+ onClick: handleClick,
58
+ disabled: t3,
59
+ children: t4
60
+ });
61
+ $[7] = handleClick;
62
+ $[8] = t3;
63
+ $[9] = t5;
64
+ } else t5 = $[9];
65
+ return t5;
66
+ }
67
+ function _temp(column) {
68
+ return column.value ? [{
69
+ header: column.exportHeader ?? title(column.key),
70
+ value: column.value
71
+ }] : [];
72
+ }
73
+ export { ExportCsvButton as default };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Downloads `csv` as `<base>-YYYYMMDD-HHMMSS.csv`. No BOM — the platform's own
3
+ * exporter emits none; an Excel user who needs one can import instead.
4
+ */
5
+ export declare function downloadCsv(csv: string, base: string): void;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { buildExportFilename, downloadBlob } from "./download-file.mjs";
3
+ // src/export/download-csv.ts
4
+ /**
5
+ * Downloads `csv` as `<base>-YYYYMMDD-HHMMSS.csv`. No BOM — the platform's own
6
+ * exporter emits none; an Excel user who needs one can import instead.
7
+ */
8
+ function downloadCsv(csv, base) {
9
+ downloadBlob(new Blob([csv], { type: "text/csv;charset=utf-8" }), buildExportFilename(base, "csv", /* @__PURE__ */ new Date()));
10
+ }
11
+ export { downloadCsv };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `<base>-YYYYMMDD-HHMMSS.<extension>`, an export's file name.
3
+ *
4
+ * @remarks
5
+ * `base` is sanitised to `[A-Za-z0-9._-]` so a model or view name can
6
+ * never inject a path separator. `now` is an explicit argument so the
7
+ * stamp is testable.
8
+ */
9
+ export declare function buildExportFilename(base: string, extension: string, now: Date): string;
10
+ /** Triggers a browser download of `blob` as `filename`. */
11
+ export declare function downloadBlob(blob: Blob, filename: string): void;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ // src/export/download-file.ts
3
+ function pad(value) {
4
+ return String(value).padStart(2, "0");
5
+ }
6
+ /**
7
+ * `<base>-YYYYMMDD-HHMMSS.<extension>`, an export's file name.
8
+ *
9
+ * @remarks
10
+ * `base` is sanitised to `[A-Za-z0-9._-]` so a model or view name can
11
+ * never inject a path separator. `now` is an explicit argument so the
12
+ * stamp is testable.
13
+ */
14
+ function buildExportFilename(base, extension, now) {
15
+ return `${base.replaceAll(/[^a-zA-Z0-9._-]/gu, "-")}-${`${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`}.${extension}`;
16
+ }
17
+ /** Triggers a browser download of `blob` as `filename`. */
18
+ function downloadBlob(blob, filename) {
19
+ const url = URL.createObjectURL(blob);
20
+ const anchor = document.createElement("a");
21
+ anchor.href = url;
22
+ anchor.download = filename;
23
+ anchor.style.display = "none";
24
+ document.body.append(anchor);
25
+ try {
26
+ anchor.click();
27
+ } finally {
28
+ anchor.remove();
29
+ URL.revokeObjectURL(url);
30
+ }
31
+ }
32
+ export { buildExportFilename, downloadBlob };
@@ -0,0 +1,2 @@
1
+ /** Downloads `data`, pretty-printed, as `<base>-YYYYMMDD-HHMMSS.json`. */
2
+ export declare function downloadJson(data: unknown, base: string): void;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { buildExportFilename, downloadBlob } from "./download-file.mjs";
3
+ // src/export/download-json.ts
4
+ /** Downloads `data`, pretty-printed, as `<base>-YYYYMMDD-HHMMSS.json`. */
5
+ function downloadJson(data, base) {
6
+ downloadBlob(new Blob([JSON.stringify(data, null, 2)], { type: "application/json;charset=utf-8" }), buildExportFilename(base, "json", /* @__PURE__ */ new Date()));
7
+ }
8
+ export { downloadJson };