@altertable/data-app 0.68.0 → 0.69.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 (175) hide show
  1. package/AGENTS.md +6 -0
  2. package/CONTRIBUTING.md +27 -1
  3. package/README.md +18 -21
  4. package/THIRD_PARTY_NOTICES +18 -0
  5. package/dist/chunks/index-22d576sn.js +153 -0
  6. package/dist/chunks/index-22d576sn.js.map +11 -0
  7. package/dist/chunks/{index-ktmvs916.js → index-2sbp9h2b.js} +37 -21
  8. package/dist/chunks/index-2sbp9h2b.js.map +13 -0
  9. package/dist/chunks/{index-23dktynd.js → index-ap60vggk.js} +4 -4
  10. package/dist/chunks/{index-m6n8ctfc.js → index-cv36cyna.js} +4 -4
  11. package/dist/chunks/index-cv36cyna.js.map +10 -0
  12. package/dist/chunks/{index-ag0cgnvq.js → index-k766wwwr.js} +13 -9
  13. package/dist/chunks/index-k766wwwr.js.map +13 -0
  14. package/dist/chunks/{index-mt93ff2b.js → index-kwnqycjt.js} +2 -2
  15. package/dist/chunks/index-kwnqycjt.js.map +10 -0
  16. package/dist/chunks/index-m0gbxtgp.js +355 -0
  17. package/dist/chunks/index-m0gbxtgp.js.map +13 -0
  18. package/dist/chunks/{index-gvers8jw.js → index-qhzdzca2.js} +3709 -2170
  19. package/dist/chunks/index-qhzdzca2.js.map +118 -0
  20. package/dist/chunks/{index-x69p7cv7.js → index-r7b1ftwy.js} +3 -3
  21. package/dist/chunks/index-r7b1ftwy.js.map +10 -0
  22. package/dist/chunks/{index-ev2b5aaf.js → index-sx488hvs.js} +4 -4
  23. package/dist/chunks/{index-f5cnbrjz.js → index-wss3gd3h.js} +39 -9
  24. package/dist/chunks/index-wss3gd3h.js.map +13 -0
  25. package/dist/chunks/{index-qd5xgx6y.js → index-zcqxfwdq.js} +5 -12
  26. package/dist/chunks/index-zcqxfwdq.js.map +13 -0
  27. package/dist/client/index.js +6 -6
  28. package/dist/core/appearance.js +1 -1
  29. package/dist/core/config.js +3 -3
  30. package/dist/core/contract.js +3 -3
  31. package/dist/core/format.js +10 -2
  32. package/dist/core/format.js.map +1 -1
  33. package/dist/embed/index.js +26 -25
  34. package/dist/embed/index.js.map +4 -4
  35. package/dist/index.js +3 -3
  36. package/dist/local.js +166 -144
  37. package/dist/local.js.map +8 -7
  38. package/dist/preview.js +1456 -0
  39. package/dist/preview.js.map +17 -0
  40. package/dist/react/embed/index.js +1 -1
  41. package/dist/react/index.js +250 -93
  42. package/dist/react/index.js.map +10 -10
  43. package/dist/react/ui/index.js +1168 -1165
  44. package/dist/react/ui/index.js.map +13 -11
  45. package/dist/server.js +68 -57
  46. package/dist/server.js.map +7 -6
  47. package/dist/types/client/download.d.ts +5 -0
  48. package/dist/types/client/iframe.d.ts +4 -2
  49. package/dist/types/client/logger.d.ts +10 -2
  50. package/dist/types/core/annotations.d.ts +5 -0
  51. package/dist/types/core/appearance.d.ts +2 -0
  52. package/dist/types/core/bridge-endpoint.d.ts +2 -2
  53. package/dist/types/core/bridge.d.ts +22 -0
  54. package/dist/types/core/config.d.ts +5 -0
  55. package/dist/types/core/contract.d.ts +3 -1
  56. package/dist/types/core/date-format.d.ts +24 -0
  57. package/dist/types/core/dimension.d.ts +2 -1
  58. package/dist/types/core/filters.d.ts +4 -3
  59. package/dist/types/core/format.d.ts +5 -3
  60. package/dist/types/core/messages.d.ts +3 -1
  61. package/dist/types/core/operation-types.d.ts +7 -7
  62. package/dist/types/core/time-interval.d.ts +96 -0
  63. package/dist/types/core/variables.d.ts +13 -4
  64. package/dist/types/embed/host.d.ts +4 -4
  65. package/dist/types/react/annotations/annotation-editor-state.d.ts +2 -0
  66. package/dist/types/react/annotations/annotation-targets.d.ts +1 -0
  67. package/dist/types/react/annotations/getAnnotationProps.d.ts +5 -3
  68. package/dist/types/react/annotations/useAnnotationGeometry.d.ts +2 -2
  69. package/dist/types/react/bindings.d.ts +26 -3
  70. package/dist/types/react/date-formatting.d.ts +12 -0
  71. package/dist/types/react/hooks.d.ts +10 -9
  72. package/dist/types/react/index.d.ts +7 -2
  73. package/dist/types/react/search-suggestions.d.ts +8 -0
  74. package/dist/types/react/style-contract.d.ts +1 -5
  75. package/dist/types/react/ui/ChartLegend.d.ts +3 -2
  76. package/dist/types/react/ui/ChoicePicker.d.ts +2 -0
  77. package/dist/types/react/ui/DataApp.d.ts +5 -4
  78. package/dist/types/react/ui/DataAppFrame.d.ts +14 -3
  79. package/dist/types/react/ui/DataTable.d.ts +6 -4
  80. package/dist/types/react/ui/DataWidget.d.ts +4 -0
  81. package/dist/types/react/ui/DateDisplay.d.ts +9 -0
  82. package/dist/types/react/ui/DateRangePicker.d.ts +3 -1
  83. package/dist/types/react/ui/DateTimeTooltip.d.ts +3 -2
  84. package/dist/types/react/ui/DimensionPicker.d.ts +3 -1
  85. package/dist/types/react/ui/EmptyState.d.ts +1 -1
  86. package/dist/types/react/ui/GradientScroll.d.ts +8 -0
  87. package/dist/types/react/ui/Grid.d.ts +1 -1
  88. package/dist/types/react/ui/MetricWidget.d.ts +2 -0
  89. package/dist/types/react/ui/NumberFilterPicker.d.ts +3 -1
  90. package/dist/types/react/ui/PeriodSummary.d.ts +2 -1
  91. package/dist/types/react/ui/PickerField.d.ts +15 -0
  92. package/dist/types/react/ui/PopoverSurface.d.ts +5 -0
  93. package/dist/types/react/ui/RequestHint.d.ts +2 -2
  94. package/dist/types/react/ui/SearchField.d.ts +3 -1
  95. package/dist/types/react/ui/SearchTypeahead.d.ts +15 -0
  96. package/dist/types/react/ui/SectionHeading.d.ts +8 -0
  97. package/dist/types/react/ui/Select.d.ts +5 -1
  98. package/dist/types/react/ui/Sheet.d.ts +3 -1
  99. package/dist/types/react/ui/TableWidget.d.ts +8 -0
  100. package/dist/types/react/ui/Tabs.d.ts +4 -3
  101. package/dist/types/react/ui/VariableBar.d.ts +1 -1
  102. package/dist/types/react/ui/VisualizationWidget.d.ts +1 -1
  103. package/dist/types/react/ui/chart-date-axis.d.ts +15 -0
  104. package/dist/types/react/ui/chart-interaction.d.ts +21 -0
  105. package/dist/types/react/ui/chart-primitives.d.ts +4 -4
  106. package/dist/types/react/ui/chart-time.d.ts +16 -0
  107. package/dist/types/react/ui/chartColor.d.ts +1 -1
  108. package/dist/types/react/ui/icons.d.ts +3 -1
  109. package/dist/types/react/ui/index.d.ts +8 -4
  110. package/dist/types/react/ui/metric-comparison.d.ts +2 -2
  111. package/dist/types/react/ui/metric.d.ts +2 -2
  112. package/dist/types/react/ui/presentation.d.ts +2 -0
  113. package/dist/types/react/ui/searchItems.d.ts +2 -0
  114. package/dist/types/react/ui/variables.d.ts +1 -1
  115. package/dist/types/react/view-control-bar.d.ts +16 -0
  116. package/dist/types/react/view-controls.d.ts +3 -2
  117. package/dist/types/react/view-runtime.d.ts +3 -1
  118. package/dist/types/react/view.d.ts +14 -2
  119. package/dist/types/server/local.d.ts +3 -1
  120. package/dist/types/server/preview/host.d.ts +1 -0
  121. package/dist/types/server/preview/index.d.ts +16 -0
  122. package/dist/types/server/reload-channel.d.ts +6 -0
  123. package/dist/types/server/request-body.d.ts +4 -0
  124. package/dist/worker.js +1 -1
  125. package/docs/app-authoring.md +17 -9
  126. package/docs/client.md +1 -1
  127. package/docs/contract.md +8 -9
  128. package/docs/embed.md +11 -3
  129. package/docs/formatting-and-appearance.md +36 -5
  130. package/docs/layout.md +31 -8
  131. package/docs/react-embed.md +4 -4
  132. package/docs/react.md +1 -1
  133. package/docs/server-bun.md +25 -0
  134. package/docs/server.md +1 -1
  135. package/docs/styling.md +7 -28
  136. package/docs/ui.md +21 -18
  137. package/docs/variables.md +92 -15
  138. package/docs/views.md +13 -36
  139. package/docs/widgets.md +38 -26
  140. package/examples/starter-data-app/index.tsx +0 -1
  141. package/examples/starter-local-data-app/.bun-version +1 -0
  142. package/examples/starter-local-data-app/.node-version +1 -0
  143. package/examples/starter-local-data-app/.oxfmtrc.json +4 -0
  144. package/examples/starter-local-data-app/.oxlintrc.json +33 -0
  145. package/examples/starter-local-data-app/AGENTS.md +22 -0
  146. package/examples/starter-local-data-app/README.md +54 -0
  147. package/examples/starter-local-data-app/app.ts +22 -0
  148. package/examples/starter-local-data-app/bunfig.toml +2 -0
  149. package/examples/starter-local-data-app/package.json +33 -0
  150. package/examples/starter-local-data-app/src/App.tsx +8 -0
  151. package/examples/starter-local-data-app/src/assets.d.ts +1 -0
  152. package/examples/starter-local-data-app/src/data-context.ts +21 -0
  153. package/examples/starter-local-data-app/src/favicon.svg +13 -0
  154. package/examples/starter-local-data-app/src/index.html +14 -0
  155. package/examples/starter-local-data-app/src/main.tsx +7 -0
  156. package/examples/starter-local-data-app/src/operations.ts +6 -0
  157. package/examples/starter-local-data-app/src/server.ts +6 -0
  158. package/examples/starter-local-data-app/tsconfig.json +15 -0
  159. package/package.json +13 -3
  160. package/dist/chunks/index-ag0cgnvq.js.map +0 -13
  161. package/dist/chunks/index-dq7b35fn.js +0 -307
  162. package/dist/chunks/index-dq7b35fn.js.map +0 -13
  163. package/dist/chunks/index-f5cnbrjz.js.map +0 -13
  164. package/dist/chunks/index-gvers8jw.js.map +0 -109
  165. package/dist/chunks/index-ktmvs916.js.map +0 -13
  166. package/dist/chunks/index-m6n8ctfc.js.map +0 -10
  167. package/dist/chunks/index-mev09s5v.js +0 -77
  168. package/dist/chunks/index-mev09s5v.js.map +0 -10
  169. package/dist/chunks/index-mt93ff2b.js.map +0 -10
  170. package/dist/chunks/index-qd5xgx6y.js.map +0 -13
  171. package/dist/chunks/index-x69p7cv7.js.map +0 -10
  172. package/dist/types/react/shellStyles.d.ts +0 -3
  173. package/dist/types/react/ui/DataAppSkeleton.d.ts +0 -7
  174. /package/dist/chunks/{index-23dktynd.js.map → index-ap60vggk.js.map} +0 -0
  175. /package/dist/chunks/{index-ev2b5aaf.js.map → index-sx488hvs.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
- injectStyles,
3
2
  injectDataAppStyles2,
3
+ useDateFormatting2,
4
4
  AppIcon2,
5
5
  classNames,
6
6
  Button2,
@@ -10,8 +10,8 @@ import {
10
10
  Tooltip2,
11
11
  GradientScroll2,
12
12
  Sheet2,
13
- TabList2,
14
13
  TabPanels2,
14
+ TabList2,
15
15
  Tab2,
16
16
  TabPanel2,
17
17
  Tabs2,
@@ -19,17 +19,21 @@ import {
19
19
  AboutData2,
20
20
  DataAppProvider2,
21
21
  useDeclaredResult,
22
+ HelpPopover2,
23
+ DateDisplay2,
22
24
  validateChoiceOptions,
23
25
  useAppVariables2,
26
+ SearchField2,
27
+ SearchMatch2,
28
+ matchSearchText2,
29
+ searchItems2,
30
+ SearchTypeahead2,
24
31
  Select2,
25
32
  FilterActions2,
33
+ VariableBar2,
26
34
  NumberField2,
27
35
  NumberRangeField2,
28
36
  NumberFilterPicker2,
29
- SearchField2,
30
- Skeleton2,
31
- SearchMatch2,
32
- searchItems2,
33
37
  ChoicePicker2,
34
38
  CheckboxGroupContext,
35
39
  Checkbox2,
@@ -46,13 +50,10 @@ import {
46
50
  MenuSeparator2,
47
51
  LiveControl2,
48
52
  PresentStory2,
49
- VariableBar2,
50
53
  DataAppFrame,
51
- Grid2,
52
54
  DataWidget2,
53
55
  VisualizationWidget2,
54
56
  MetricWidget2,
55
- HelpPopover2,
56
57
  DataTable2,
57
58
  DataTableShare2,
58
59
  DataTableEmptyRow2,
@@ -61,758 +62,27 @@ import {
61
62
  TextWidget2,
62
63
  DataValue2,
63
64
  chartBarFill,
64
- createDataContext2
65
- } from "../../chunks/index-gvers8jw.js";
65
+ createDataContext2,
66
+ SectionHeading2
67
+ } from "../../chunks/index-qhzdzca2.js";
66
68
  import {
69
+ formatDate2,
70
+ parseDateTime2,
71
+ formatDateTime2,
67
72
  formatNumber2,
68
73
  formatPercent2
69
- } from "../../chunks/index-mev09s5v.js";
70
- import"../../chunks/index-ag0cgnvq.js";
71
- import"../../chunks/index-mt93ff2b.js";
72
- import"../../chunks/index-m6n8ctfc.js";
74
+ } from "../../chunks/index-22d576sn.js";
75
+ import"../../chunks/index-k766wwwr.js";
76
+ import"../../chunks/index-kwnqycjt.js";
77
+ import"../../chunks/index-cv36cyna.js";
73
78
  import {
74
79
  createDataClient2
75
- } from "../../chunks/index-23dktynd.js";
76
- import"../../chunks/index-x69p7cv7.js";
77
- import"../../chunks/index-ev2b5aaf.js";
80
+ } from "../../chunks/index-ap60vggk.js";
81
+ import"../../chunks/index-r7b1ftwy.js";
82
+ import"../../chunks/index-sx488hvs.js";
78
83
  import {
79
84
  invariant
80
- } from "../../chunks/index-qd5xgx6y.js";
81
-
82
- // src/react/shellStyles.ts
83
- function injectDataAppShellStyles(options = {}) {
84
- return injectStyles({
85
- name: "injectDataAppShellStyles",
86
- attribute: "data-altertable-shell-styles",
87
- css: `/* src/react/tokens.css */
88
- @layer atbl.tokens {
89
- :root {
90
- --atbl-control-text-size: var(--atbl-type-body-size);
91
- --atbl-background: var(--atbl-palette-background);
92
- --atbl-surface: var(--atbl-palette-surface);
93
- --atbl-subtle: var(--atbl-palette-subtle);
94
- --atbl-backdrop: #0f171e38;
95
- --atbl-text: var(--atbl-palette-text);
96
- --atbl-muted: var(--atbl-palette-muted);
97
- --atbl-border: var(--atbl-palette-border);
98
- --atbl-accent: var(--atbl-input-accent, #405d47);
99
- --atbl-on-accent: var(--atbl-input-on-accent, #fff);
100
- --atbl-danger: #b42318;
101
- --atbl-danger-subtle: color-mix(in srgb, var(--atbl-danger) 9%, var(--atbl-surface));
102
- --atbl-code-surface: #f4f6f9;
103
- --atbl-code-text: #273242;
104
- --atbl-mono-font: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
105
- --atbl-focus-ring-offset: 2px;
106
- --atbl-focus-ring-inset: -1px;
107
- --atbl-font: var(--atbl-input-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, ui-sans-serif, sans-serif);
108
- --atbl-space-xs: 5px;
109
- --atbl-space-sm: 10px;
110
- --atbl-space-md: 16px;
111
- --atbl-space-lg: 24px;
112
- --atbl-space-xl: 32px;
113
- --atbl-content-width: 960px;
114
- --atbl-control-height: 2.375rem;
115
- --atbl-control-compact-height: 1.875rem;
116
- --atbl-control-icon-size: 1rem;
117
- --atbl-control-padding-inline: .75rem;
118
- --atbl-control-padding-block: .375rem;
119
- --atbl-control-gap: .5rem;
120
- --atbl-control-disabled-opacity: .5;
121
- --atbl-radius-control: 7px;
122
- --atbl-radius-surface: 12px;
123
- --atbl-radius-overlay: 16px;
124
- --atbl-shadow-surface: 0 3px 16px #141c280d;
125
- --atbl-shadow-overlay: 0 18px 50px #00000029;
126
- --atbl-shadow-control: 0 1px 3px #0000001a;
127
- --atbl-cursor-action: pointer;
128
- --atbl-cursor-disabled: default;
129
- --atbl-cursor-help: help;
130
- --atbl-cursor-busy: progress;
131
- --atbl-duration-fast: .12s;
132
- --atbl-duration-normal: .18s;
133
- --atbl-duration-slow: .24s;
134
- --atbl-ease-standard: ease;
135
- --atbl-ease-enter: cubic-bezier(.2, .7, .2, 1);
136
- --atbl-chart-1: color-mix(in srgb, var(--atbl-input-chart-1, #285fc0) var(--atbl-chart-strength), white);
137
- --atbl-chart-2: color-mix(in srgb, var(--atbl-input-chart-2, #a95319) var(--atbl-chart-strength), white);
138
- --atbl-chart-3: color-mix(in srgb, var(--atbl-input-chart-3, #147862) var(--atbl-chart-strength), white);
139
- --atbl-chart-4: color-mix(in srgb, var(--atbl-input-chart-4, #7243aa) var(--atbl-chart-strength), white);
140
- --atbl-chart-5: color-mix(in srgb, var(--atbl-input-chart-5, #aa3958) var(--atbl-chart-strength), white);
141
- --atbl-chart-6: color-mix(in srgb, var(--atbl-input-chart-6, #475569) var(--atbl-chart-strength), white);
142
- --atbl-chart-7: color-mix(in srgb, var(--atbl-input-chart-7, #285fc0) var(--atbl-chart-strength), white);
143
- --atbl-chart-8: color-mix(in srgb, var(--atbl-input-chart-8, #a95319) var(--atbl-chart-strength), white);
144
- --atbl-type-emphasis-weight: 680;
145
- --atbl-type-meta-weight: 500;
146
- --atbl-type-page-size: clamp(1.375rem, 2.4vw, 1.75rem);
147
- --atbl-type-section-size: 1.25rem;
148
- --atbl-type-widget-size: 1.0625rem;
149
- --atbl-type-body-size: .875rem;
150
- --atbl-type-label-size: .8125rem;
151
- --atbl-type-meta-size: .75rem;
152
- --atbl-type-metric-size: clamp(1.625rem, 3vw, 2.125rem);
153
- --atbl-type-heading-weight: 650;
154
- --atbl-type-label-weight: 600;
155
- --atbl-type-body-leading: 1.65;
156
- --atbl-type-label-leading: 1.4;
157
- --atbl-type-heading-leading: 1.3;
158
- --atbl-type-metric-leading: 1.08;
159
- --atbl-text-measure: 70ch;
160
- }
161
- }
162
-
163
- /* src/react/appearance.css */
164
- @layer atbl.tokens {
165
- :root {
166
- --atbl-palette-background: #fff;
167
- --atbl-palette-surface: #fff;
168
- --atbl-palette-subtle: #f6f7f7;
169
- --atbl-palette-text: #202124;
170
- --atbl-palette-muted: #687078;
171
- --atbl-palette-border: #e3e6e8;
172
- --atbl-chart-strength: 100%;
173
- --atbl-accent-subtle-strength: 12%;
174
- }
175
-
176
- :root[data-atbl-theme="dark"] {
177
- --atbl-palette-background: #151719;
178
- --atbl-palette-surface: #202326;
179
- --atbl-palette-subtle: #292d31;
180
- --atbl-palette-text: #f2f3f4;
181
- --atbl-palette-muted: #aeb5bc;
182
- --atbl-palette-border: #3b4248;
183
- }
184
-
185
- :root[data-atbl-base-color="slate"] {
186
- --atbl-palette-background: #f8fafc;
187
- --atbl-palette-surface: #fff;
188
- --atbl-palette-subtle: #f1f5f9;
189
- --atbl-palette-text: #17212f;
190
- --atbl-palette-muted: #607083;
191
- --atbl-palette-border: #dce3ea;
192
- }
193
-
194
- :root[data-atbl-base-color="slate"][data-atbl-theme="dark"] {
195
- --atbl-palette-background: #111820;
196
- --atbl-palette-surface: #1b2530;
197
- --atbl-palette-subtle: #263340;
198
- --atbl-palette-text: #f0f4f8;
199
- --atbl-palette-muted: #a8b5c3;
200
- --atbl-palette-border: #3a4857;
201
- }
202
-
203
- :root[data-atbl-base-color="warm"] {
204
- --atbl-palette-background: #fbfaf8;
205
- --atbl-palette-surface: #fff;
206
- --atbl-palette-subtle: #f5f2ed;
207
- --atbl-palette-text: #292723;
208
- --atbl-palette-muted: #736e66;
209
- --atbl-palette-border: #e8e2da;
210
- }
211
-
212
- :root[data-atbl-base-color="warm"][data-atbl-theme="dark"] {
213
- --atbl-palette-background: #1b1916;
214
- --atbl-palette-surface: #25221e;
215
- --atbl-palette-subtle: #302c27;
216
- --atbl-palette-text: #f5f1eb;
217
- --atbl-palette-muted: #bcb3a8;
218
- --atbl-palette-border: #494239;
219
- }
220
-
221
- :root[data-atbl-theme="dark"] {
222
- --atbl-accent: var(--atbl-input-dark-accent, color-mix(in srgb, var(--atbl-input-accent, #405d47) 50%, white));
223
- --atbl-accent-subtle-strength: 22%;
224
- --atbl-on-accent: var(--atbl-input-on-accent, var(--atbl-background));
225
- --atbl-danger: #f97066;
226
- --atbl-backdrop: #0000008c;
227
- --atbl-code-surface: #242a31;
228
- --atbl-code-text: #e5e9ef;
229
- --atbl-chart-strength: 60%;
230
- }
231
-
232
- :root[data-atbl-density="compact"] {
233
- --atbl-control-height: 2.125rem;
234
- --atbl-control-padding-inline: .625rem;
235
- --atbl-control-padding-block: .25rem;
236
- --atbl-space-xs: 4px;
237
- --atbl-space-sm: 8px;
238
- --atbl-space-md: 12px;
239
- --atbl-space-lg: 18px;
240
- --atbl-space-xl: 24px;
241
- }
242
-
243
- :root[data-atbl-density="spacious"] {
244
- --atbl-control-height: 2.625rem;
245
- --atbl-control-padding-inline: 1rem;
246
- --atbl-control-padding-block: .5rem;
247
- --atbl-space-xs: 6px;
248
- --atbl-space-sm: 12px;
249
- --atbl-space-md: 20px;
250
- --atbl-space-lg: 30px;
251
- --atbl-space-xl: 40px;
252
- }
253
-
254
- :root[data-atbl-radius="none"] {
255
- --atbl-radius-control: 0px;
256
- --atbl-radius-surface: 0px;
257
- --atbl-radius-overlay: 0px;
258
- }
259
-
260
- :root[data-atbl-radius="small"] {
261
- --atbl-radius-control: 4px;
262
- --atbl-radius-surface: 7px;
263
- --atbl-radius-overlay: 9px;
264
- }
265
-
266
- :root[data-atbl-radius="large"] {
267
- --atbl-radius-control: 10px;
268
- --atbl-radius-surface: 18px;
269
- --atbl-radius-overlay: 24px;
270
- }
271
-
272
- :root[data-atbl-elevation="flat"] {
273
- --atbl-shadow-surface: none;
274
- --atbl-shadow-overlay: none;
275
- --atbl-shadow-control: none;
276
- }
277
-
278
- :root[data-atbl-elevation="raised"] {
279
- --atbl-shadow-surface: 0 8px 28px #141c281a;
280
- --atbl-shadow-overlay: 0 24px 72px #0000003d;
281
- }
282
-
283
- @media (forced-colors: active) {
284
- :root {
285
- --atbl-focus-color: Highlight !important;
286
- --atbl-on-accent: HighlightText !important;
287
- }
288
- }
289
- }
290
-
291
- /* src/react/base.css */
292
- @layer atbl.base {
293
- :where([class^="altertable-"], [class*=" altertable-"]) {
294
- box-sizing: border-box;
295
- }
296
-
297
- :where([class^="altertable-"], [class*=" altertable-"]) * {
298
- box-sizing: border-box;
299
- }
300
-
301
- :where([class^="starter-"], [class*=" starter-"]) * {
302
- box-sizing: border-box;
303
- }
304
-
305
- :where([class^="altertable-"], [class*=" altertable-"]) button {
306
- font: inherit;
307
- }
308
-
309
- :root[data-atbl-appearance] {
310
- scrollbar-gutter: stable;
311
- font-family: var(--atbl-font);
312
- color: var(--atbl-text);
313
- background: var(--atbl-background);
314
- font-synthesis: none;
315
- -webkit-font-smoothing: antialiased;
316
- text-rendering: optimizeLegibility;
317
- }
318
-
319
- :root[data-atbl-theme="light"] {
320
- --buncss-light: initial;
321
- --buncss-dark: ;
322
- color-scheme: light;
323
- }
324
-
325
- :root[data-atbl-theme="dark"] {
326
- --buncss-light: ;
327
- --buncss-dark: initial;
328
- color-scheme: dark;
329
- }
330
-
331
- :root[data-atbl-appearance] body, :root[data-atbl-appearance] #root {
332
- margin: 0;
333
- }
334
-
335
- .altertable-sr-only {
336
- position: fixed;
337
- overflow: hidden;
338
- clip: rect(0, 0, 0, 0);
339
- clip-path: inset(50%);
340
- white-space: nowrap;
341
- border: 0;
342
- width: 1px;
343
- height: 1px;
344
- margin: -1px;
345
- padding: 0;
346
- }
347
- }
348
-
349
- /* src/react/ui/Skeleton.css */
350
- @layer atbl.components {
351
- .altertable-skeleton {
352
- display: block;
353
- border-radius: var(--atbl-radius-control);
354
- background: var(--atbl-subtle);
355
- opacity: 0;
356
- animation: altertable-skeleton-in .2s var(--atbl-ease-standard) .2s forwards, altertable-skeleton-pulse 1.4s ease-in-out .4s infinite alternate;
357
- }
358
-
359
- .altertable-skeleton[data-inline] {
360
- display: inline-block;
361
- vertical-align: middle;
362
- width: 8ch;
363
- height: 1em;
364
- }
365
-
366
- @keyframes altertable-skeleton-in {
367
- to {
368
- opacity: 1;
369
- }
370
- }
371
-
372
- @keyframes altertable-skeleton-pulse {
373
- to {
374
- opacity: .5;
375
- }
376
- }
377
-
378
- @media (prefers-reduced-motion: reduce) {
379
- .altertable-skeleton {
380
- animation: 1ms .2s forwards altertable-skeleton-in;
381
- }
382
- }
383
- }
384
-
385
- /* src/react/ui/Grid.css */
386
- @layer atbl.components {
387
- .altertable-grid {
388
- display: grid;
389
- container: altertable-grid / inline-size;
390
- --atbl-grid-gap: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
391
- --atbl-grid-min-item-width: 240px;
392
- --atbl-grid-column-width: 100%;
393
- --atbl-grid-max-columns: 1;
394
- align-content: start;
395
- align-items: start;
396
- gap: var(--atbl-grid-gap);
397
- grid-template-columns: repeat(auto-fit, minmax(min(100%, max(var(--atbl-grid-min-item-width), var(--atbl-grid-column-width))), 1fr));
398
- min-width: 0;
399
- }
400
-
401
- .altertable-grid > * {
402
- min-width: 0;
403
- min-height: 0;
404
- margin: 0;
405
- }
406
-
407
- .altertable-grid[data-align="stretch"] {
408
- align-items: stretch;
409
- }
410
-
411
- .altertable-grid[data-gap="sm"] {
412
- --atbl-grid-gap: var(--atbl-space-sm);
413
- }
414
-
415
- .altertable-grid[data-gap="md"] {
416
- --atbl-grid-gap: var(--atbl-space-md);
417
- }
418
-
419
- .altertable-grid[data-gap="lg"] {
420
- --atbl-grid-gap: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
421
- }
422
-
423
- .altertable-grid[data-min-item-width="compact"] {
424
- --atbl-grid-min-item-width: 192px;
425
- }
426
-
427
- .altertable-grid[data-min-item-width="wide"] {
428
- --atbl-grid-min-item-width: 320px;
429
- }
430
-
431
- .altertable-grid[data-columns="2"] {
432
- --atbl-grid-max-columns: 2;
433
- --atbl-grid-column-width: calc((100% - var(--atbl-grid-gap)) / 2);
434
- }
435
-
436
- .altertable-grid[data-columns="3"] {
437
- --atbl-grid-max-columns: 3;
438
- --atbl-grid-column-width: calc((100% - var(--atbl-grid-gap) - var(--atbl-grid-gap)) / 3);
439
- }
440
-
441
- .altertable-grid[data-columns="4"] {
442
- --atbl-grid-max-columns: 4;
443
- --atbl-grid-column-width: calc((100% - var(--atbl-grid-gap) - var(--atbl-grid-gap) - var(--atbl-grid-gap)) / 4);
444
- }
445
-
446
- .altertable-grid-item {
447
- min-width: 0;
448
- min-height: 0;
449
- }
450
-
451
- .altertable-grid > * {
452
- --atbl-grid-fitting-columns: clamp(1, round(down, tan(atan2(100cqw + var(--atbl-grid-gap) + .001px, var(--atbl-grid-min-item-width) + var(--atbl-grid-gap))), 1), var(--atbl-grid-max-columns));
453
- }
454
-
455
- .altertable-grid > .altertable-grid-item[data-span="2"] {
456
- grid-column: span min(2, var(--atbl-grid-fitting-columns));
457
- }
458
-
459
- .altertable-grid[data-columns="3"]:has( > .altertable-grid-item[data-span="2"]) > :not(.altertable-grid-item[data-span="2"]) {
460
- grid-column: span clamp(1, (3 - var(--atbl-grid-fitting-columns)) * 2, var(--atbl-grid-fitting-columns));
461
- }
462
-
463
- .altertable-grid[data-columns="3"]:not(:has( > .altertable-grid-item[data-span="2"])) > :last-child:nth-child(odd) {
464
- grid-column: span clamp(1, (3 - var(--atbl-grid-fitting-columns)) * 2, var(--atbl-grid-fitting-columns));
465
- }
466
- }
467
-
468
- /* src/react/ui/DataWidget.css */
469
- @layer atbl.components {
470
- .altertable-data-widget {
471
- border: 1px solid var(--atbl-border);
472
- border-radius: calc(var(--atbl-radius-surface) * 1.5);
473
- corner-shape: squircle;
474
- background: var(--atbl-surface);
475
- box-shadow: var(--atbl-shadow-surface);
476
- min-width: 0;
477
- }
478
-
479
- .altertable-data-widget-header {
480
- display: flex;
481
- justify-content: space-between;
482
- align-items: flex-start;
483
- gap: var(--atbl-space-md);
484
- padding: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg))) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg))) 0;
485
- min-height: 30px;
486
- }
487
-
488
- .altertable-data-widget-header > div:first-child {
489
- flex: 1;
490
- min-width: 0;
491
- }
492
-
493
- .altertable-data-widget-help {
494
- display: flex;
495
- flex: none;
496
- align-items: flex-start;
497
- }
498
-
499
- .altertable-data-widget-header h2 {
500
- color: var(--atbl-text);
501
- font-family: var(--atbl-font-heading, var(--atbl-input-font-heading, var(--atbl-font)));
502
- font-size: var(--atbl-type-widget-size);
503
- font-weight: var(--atbl-type-heading-weight);
504
- line-height: var(--atbl-type-heading-leading);
505
- letter-spacing: -.02em;
506
- margin: 0;
507
- }
508
-
509
- .altertable-data-widget-count {
510
- color: var(--atbl-muted);
511
- font-size: var(--atbl-type-meta-size);
512
- font-weight: var(--atbl-type-meta-weight);
513
- letter-spacing: 0;
514
- white-space: nowrap;
515
- margin-left: 8px;
516
- }
517
-
518
- .altertable-data-widget-header p {
519
- color: var(--atbl-muted);
520
- font-size: var(--atbl-type-meta-size);
521
- margin: 4px 0 0;
522
- line-height: 1.45;
523
- }
524
-
525
- .altertable-data-widget-body {
526
- padding: var(--atbl-space-md) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg))) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
527
- min-width: 0;
528
- }
529
-
530
- .altertable-data-widget-body[data-padding="flush"] {
531
- padding: 0;
532
- }
533
-
534
- .altertable-data-widget-footer {
535
- padding: var(--atbl-space-md) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
536
- }
537
-
538
- .altertable-data-widget-body > .altertable-status-panel {
539
- background: none;
540
- border: 0;
541
- border-radius: 0;
542
- margin: 0;
543
- padding: 0;
544
- }
545
- }
546
-
547
- /* src/react/ui/MetricWidget.css */
548
- @layer atbl.components {
549
- .altertable-metric-widget {
550
- display: flex;
551
- padding: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
552
- border: 1px solid var(--atbl-border);
553
- border-radius: calc(var(--atbl-radius-surface) * 1.5);
554
- corner-shape: squircle;
555
- background: var(--atbl-surface);
556
- box-shadow: var(--atbl-shadow-surface);
557
- flex-direction: column;
558
- min-width: 0;
559
- }
560
-
561
- .altertable-metric-widget.altertable-data-widget {
562
- padding: 0;
563
- }
564
-
565
- .altertable-metric-widget > .altertable-data-widget-header {
566
- min-height: 0;
567
- }
568
-
569
- .altertable-metric-widget > .altertable-data-widget-header h2 {
570
- color: var(--atbl-muted);
571
- font-family: inherit;
572
- font-size: var(--atbl-type-label-size);
573
- font-weight: var(--atbl-type-label-weight);
574
- letter-spacing: normal;
575
- }
576
-
577
- .altertable-metric-widget > .altertable-data-widget-body {
578
- padding-top: 0;
579
- }
580
-
581
- .altertable-metric-widget > .altertable-data-widget-body:has( + footer) {
582
- padding-bottom: 0;
583
- }
584
-
585
- .altertable-metric-widget > .altertable-data-widget-footer {
586
- padding-top: 0;
587
- padding-bottom: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
588
- }
589
-
590
- .altertable-metric-value {
591
- margin: var(--atbl-space-sm) 0 2px;
592
- color: var(--atbl-text);
593
- font-family: var(--atbl-font-heading, var(--atbl-input-font-heading, var(--atbl-font)));
594
- font-size: var(--atbl-type-metric-size);
595
- font-weight: var(--atbl-type-emphasis-weight);
596
- line-height: var(--atbl-type-metric-leading);
597
- letter-spacing: -.04em;
598
- overflow-wrap: anywhere;
599
- font-variant-numeric: tabular-nums;
600
- max-inline-size: 100%;
601
- }
602
-
603
- .altertable-metric-reading {
604
- display: flex;
605
- flex-direction: column;
606
- justify-content: flex-start;
607
- align-items: flex-start;
608
- gap: 4px;
609
- }
610
-
611
- .altertable-metric-trend {
612
- font-size: var(--atbl-type-meta-size);
613
- }
614
-
615
- .altertable-metric-change {
616
- display: inline-flex;
617
- color: var(--atbl-muted);
618
- font-variant-numeric: tabular-nums;
619
- align-items: center;
620
- gap: 3px;
621
- }
622
-
623
- .altertable-metric-change[data-tone="good"] {
624
- color: var(--atbl-positive, var(--atbl-accent));
625
- }
626
-
627
- .altertable-metric-change[data-tone="bad"] {
628
- color: var(--atbl-negative, var(--atbl-danger));
629
- }
630
-
631
- .altertable-metric-description {
632
- color: var(--atbl-muted);
633
- font-size: var(--atbl-type-meta-size);
634
- line-height: 1.45;
635
- }
636
-
637
- .altertable-metric-visual {
638
- margin-top: var(--atbl-space-sm);
639
- min-width: 0;
640
- }
641
-
642
- .altertable-metric-value[data-unavailable] {
643
- opacity: .6;
644
- }
645
-
646
- .altertable-metric-value > .altertable-skeleton {
647
- width: 6ch;
648
- height: 1em;
649
- }
650
- }
651
-
652
- /* src/react/ui/VisualizationWidget.css */
653
- @layer atbl.components {
654
- .altertable-visualization-widget-content {
655
- padding: var(--atbl-space-md) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg))) var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
656
- min-width: 0;
657
- }
658
-
659
- :where(.altertable-data-widget-body) > .altertable-visualization-widget-content {
660
- padding: 0;
661
- }
662
- }
663
-
664
- /* src/react/ui/ContentSkeleton.css */
665
- @layer atbl.components {
666
- .altertable-content-skeleton {
667
- display: grid;
668
- padding: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
669
- align-content: start;
670
- gap: 14px;
671
- min-width: 0;
672
- }
673
-
674
- .altertable-content-skeleton-label {
675
- width: 38%;
676
- height: 15px;
677
- }
678
-
679
- .altertable-content-skeleton-value {
680
- width: 56%;
681
- height: 38px;
682
- }
683
-
684
- .altertable-content-skeleton-chart {
685
- width: 100%;
686
- height: 180px;
687
- }
688
-
689
- .altertable-content-skeleton-foot {
690
- width: 70%;
691
- height: 12px;
692
- }
693
-
694
- .altertable-content-skeleton-subtitle {
695
- width: 52%;
696
- height: 12px;
697
- }
698
-
699
- .altertable-content-skeleton-rows {
700
- display: grid;
701
- gap: 18px;
702
- margin-top: 12px;
703
- }
704
-
705
- .altertable-content-skeleton-row {
706
- display: grid;
707
- gap: 8px;
708
- }
709
-
710
- .altertable-content-skeleton-row-label {
711
- width: 56%;
712
- height: 14px;
713
- }
714
-
715
- .altertable-content-skeleton-row-track {
716
- width: 100%;
717
- height: 8px;
718
- }
719
-
720
- .altertable-content-skeleton-row:nth-child(2) .altertable-content-skeleton-row-track {
721
- width: 72%;
722
- }
723
-
724
- .altertable-content-skeleton-row:nth-child(3) .altertable-content-skeleton-row-track {
725
- width: 48%;
726
- }
727
-
728
- .altertable-content-skeleton-row:nth-child(4) .altertable-content-skeleton-row-track {
729
- width: 30%;
730
- }
731
-
732
- .altertable-content-skeleton-body {
733
- display: grid;
734
- gap: 14px;
735
- min-width: 0;
736
- }
737
- }
738
-
739
- /* src/react/shared.css */
740
-
741
-
742
- /* src/react/ui/DataAppSkeleton.css */
743
- @layer atbl.components {
744
- .altertable-data-app-skeleton {
745
- display: flex;
746
- overflow: hidden;
747
- padding: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
748
- background: var(--atbl-background);
749
- flex: 1;
750
- min-width: 0;
751
- min-height: 0;
752
- }
753
-
754
- .altertable-data-app-skeleton-content {
755
- display: flex;
756
- gap: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
757
- max-width: var(--atbl-content-width);
758
- flex-direction: column;
759
- width: 100%;
760
- min-width: 0;
761
- margin-inline-start: auto;
762
- margin-inline-end: auto;
763
- }
764
-
765
- .altertable-data-app-skeleton-body {
766
- display: flex;
767
- gap: var(--atbl-layout-gap, clamp(var(--atbl-space-md), 2.5vw, var(--atbl-space-lg)));
768
- flex-direction: column;
769
- min-width: 0;
770
- }
771
-
772
- .altertable-data-app-skeleton-header, .altertable-data-app-skeleton-footer {
773
- min-width: 0;
774
- }
775
-
776
- .altertable-data-app-skeleton-widget-title {
777
- width: 144px;
778
- max-width: 100%;
779
- height: 16px;
780
- }
781
-
782
- .altertable-data-app-skeleton-chart {
783
- display: flex;
784
- align-items: flex-end;
785
- gap: var(--atbl-space-sm);
786
- height: 180px;
787
- }
788
-
789
- .altertable-data-app-skeleton-chart > * {
790
- flex: 1;
791
- min-width: 0;
792
- }
793
-
794
- .altertable-data-app-skeleton-rows {
795
- display: grid;
796
- gap: 20px;
797
- }
798
-
799
- .altertable-data-app-skeleton-row {
800
- display: grid;
801
- grid-template-columns: 2fr 1fr 1fr;
802
- gap: var(--atbl-space-md);
803
- }
804
-
805
- .altertable-data-app-skeleton-row > * {
806
- height: 16px;
807
- }
808
- }
809
-
810
- /* src/react/shellStyles.css */
811
- @layer atbl.tokens, atbl.base, atbl.components, atbl.interaction;
812
- `,
813
- options
814
- });
815
- }
85
+ } from "../../chunks/index-zcqxfwdq.js";
816
86
  // src/react/ui/StaticDataApp.tsx
817
87
  import { jsx } from "react/jsx-runtime";
818
88
  function DataApp(props) {
@@ -955,78 +225,8 @@ function GettingStarted({ dataContext }) {
955
225
  ]
956
226
  });
957
227
  }
958
- // src/react/ui/DataAppSkeleton.tsx
959
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
960
- var chartHeights = [40, 60, 50, 80, 60, 100, 80, 60];
961
- function DataAppSkeleton({
962
- header,
963
- footer,
964
- className,
965
- ...props
966
- }) {
967
- return /* @__PURE__ */ jsx3("output", {
968
- "aria-label": "Loading data app",
969
- ...props,
970
- "aria-busy": "true",
971
- className: classNames("altertable-data-app-skeleton", className),
972
- children: /* @__PURE__ */ jsxs2("div", {
973
- className: "altertable-data-app-skeleton-content",
974
- children: [
975
- header != null && header !== false && /* @__PURE__ */ jsx3("div", {
976
- className: "altertable-data-app-skeleton-header",
977
- children: header
978
- }),
979
- /* @__PURE__ */ jsxs2("div", {
980
- className: "altertable-data-app-skeleton-body",
981
- "aria-hidden": "true",
982
- children: [
983
- /* @__PURE__ */ jsx3(Grid2, {
984
- columns: 3,
985
- gap: "md",
986
- children: [0, 1, 2].map((item) => /* @__PURE__ */ jsx3(MetricWidget2, {
987
- label: "",
988
- loading: true
989
- }, item))
990
- }),
991
- /* @__PURE__ */ jsx3(VisualizationWidget2, {
992
- title: /* @__PURE__ */ jsx3(Skeleton2, {
993
- className: "altertable-data-app-skeleton-widget-title"
994
- }),
995
- visual: /* @__PURE__ */ jsx3("div", {
996
- className: "altertable-data-app-skeleton-chart",
997
- children: chartHeights.map((height, index) => /* @__PURE__ */ jsx3(Skeleton2, {
998
- style: { height: `${height}%` }
999
- }, index))
1000
- })
1001
- }),
1002
- /* @__PURE__ */ jsx3(DataWidget2, {
1003
- title: /* @__PURE__ */ jsx3(Skeleton2, {
1004
- className: "altertable-data-app-skeleton-widget-title"
1005
- }),
1006
- children: /* @__PURE__ */ jsx3("div", {
1007
- className: "altertable-data-app-skeleton-rows",
1008
- children: [0, 1, 2].map((row) => /* @__PURE__ */ jsxs2("div", {
1009
- className: "altertable-data-app-skeleton-row",
1010
- children: [
1011
- /* @__PURE__ */ jsx3(Skeleton2, {}),
1012
- /* @__PURE__ */ jsx3(Skeleton2, {}),
1013
- /* @__PURE__ */ jsx3(Skeleton2, {})
1014
- ]
1015
- }, row))
1016
- })
1017
- })
1018
- ]
1019
- }),
1020
- footer != null && footer !== false && /* @__PURE__ */ jsx3("div", {
1021
- className: "altertable-data-app-skeleton-footer",
1022
- children: footer
1023
- })
1024
- ]
1025
- })
1026
- });
1027
- }
1028
228
  // src/react/ui/GlossaryExplanation.tsx
1029
- import { jsx as jsx4 } from "react/jsx-runtime";
229
+ import { jsx as jsx3 } from "react/jsx-runtime";
1030
230
  function GlossaryExplanation({
1031
231
  entry,
1032
232
  empty,
@@ -1038,7 +238,7 @@ function GlossaryExplanation({
1038
238
  className,
1039
239
  ...props
1040
240
  }) {
1041
- return /* @__PURE__ */ jsx4(AboutData2, {
241
+ return /* @__PURE__ */ jsx3(AboutData2, {
1042
242
  ...props,
1043
243
  shortcut: false,
1044
244
  iconOnly: true,
@@ -1053,18 +253,18 @@ function GlossaryExplanation({
1053
253
  className: className ?? "altertable-inspect-trigger",
1054
254
  tooltip: "Explore this term",
1055
255
  "aria-label": props["aria-label"] ?? `Explore ${entry.term}`,
1056
- children: /* @__PURE__ */ jsx4(AppIcon2, {
256
+ children: /* @__PURE__ */ jsx3(AppIcon2, {
1057
257
  name: "openDetails"
1058
258
  })
1059
259
  });
1060
260
  }
1061
261
  // src/react/ui/GlossaryDefinition.tsx
1062
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
262
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1063
263
  function GlossaryDefinition({
1064
264
  entry,
1065
265
  children
1066
266
  }) {
1067
- return /* @__PURE__ */ jsxs3(HelpPopover2, {
267
+ return /* @__PURE__ */ jsxs2(HelpPopover2, {
1068
268
  trigger: children ?? entry.term,
1069
269
  triggerLabel: `Explain ${entry.term}`,
1070
270
  label: entry.term,
@@ -1074,23 +274,683 @@ function GlossaryDefinition({
1074
274
  },
1075
275
  panelProps: { className: "altertable-glossary-definition-popover" },
1076
276
  children: [
1077
- /* @__PURE__ */ jsx5("strong", {
277
+ /* @__PURE__ */ jsx4("strong", {
1078
278
  children: entry.term
1079
279
  }),
1080
- /* @__PURE__ */ jsx5("div", {
280
+ /* @__PURE__ */ jsx4("div", {
1081
281
  children: entry.definition
1082
282
  })
1083
283
  ]
1084
284
  });
1085
285
  }
1086
286
  // src/react/ui/TrendChart.tsx
1087
- import { useLayoutEffect, useRef, useState as useState2 } from "react";
287
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState3 } from "react";
1088
288
  import {
1089
289
  AreaChart as RechartsAreaChart,
1090
290
  LineChart as RechartsLineChart,
1091
291
  ReferenceLine
1092
292
  } from "recharts";
1093
293
 
294
+ // src/react/ui/chart-date-axis.tsx
295
+ import {
296
+ createContext,
297
+ useCallback,
298
+ useContext,
299
+ useEffect,
300
+ useMemo,
301
+ useState
302
+ } from "react";
303
+ import { XAxis, usePlotArea } from "recharts";
304
+
305
+ // src/core/time-interval.ts
306
+ /*!
307
+ * TypeScript port of d3-time 3.1.0 (ISC), https://github.com/d3/d3-time/tree/v3.1.0
308
+ * Numeric tick-step helpers adapted from d3-array 3.2.4 (ISC).
309
+ *
310
+ * Copyright 2010-2022 Mike Bostock (d3-time)
311
+ * Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)
312
+ *
313
+ * Permission to use, copy, modify, and/or distribute this software for any purpose
314
+ * with or without fee is hereby granted, provided that the above copyright notice
315
+ * and this permission notice appear in all copies.
316
+ *
317
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
318
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
319
+ * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
320
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
321
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
322
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
323
+ * THIS SOFTWARE.
324
+ */
325
+ function timeInterval(floor, offset, count, field) {
326
+ function interval(value) {
327
+ const date = arguments.length === 0 ? new Date : new Date(+value);
328
+ floor(date);
329
+ return date;
330
+ }
331
+ interval.floor = (value) => {
332
+ const date = new Date(+value);
333
+ floor(date);
334
+ return date;
335
+ };
336
+ interval.ceil = (value) => {
337
+ const date = new Date(+value - 1);
338
+ floor(date);
339
+ offset(date, 1);
340
+ floor(date);
341
+ return date;
342
+ };
343
+ interval.round = (value) => {
344
+ const before = interval(value);
345
+ const after = interval.ceil(value);
346
+ return +value - +before < +after - +value ? before : after;
347
+ };
348
+ interval.offset = (value, step) => {
349
+ const date = new Date(+value);
350
+ offset(date, step == null ? 1 : Math.floor(step));
351
+ return date;
352
+ };
353
+ interval.range = (start, stop, step) => {
354
+ const range = [];
355
+ const date = interval.ceil(start);
356
+ const stride = step == null ? 1 : Math.floor(step);
357
+ if (!(+date < +stop) || !(stride > 0))
358
+ return range;
359
+ let previous;
360
+ do {
361
+ previous = new Date(+date);
362
+ range.push(previous);
363
+ offset(date, stride);
364
+ floor(date);
365
+ } while (+previous < +date && +date < +stop);
366
+ return range;
367
+ };
368
+ interval.filter = (test) => timeInterval((date) => {
369
+ if (!Number.isNaN(+date)) {
370
+ floor(date);
371
+ while (!test(date)) {
372
+ date.setTime(+date - 1);
373
+ floor(date);
374
+ }
375
+ }
376
+ }, (date, step) => {
377
+ if (!Number.isNaN(+date)) {
378
+ const direction = step < 0 ? -1 : 1;
379
+ for (let remaining = Math.abs(step);remaining > 0; --remaining) {
380
+ do {
381
+ offset(date, direction);
382
+ } while (!test(date));
383
+ }
384
+ }
385
+ });
386
+ if (count) {
387
+ interval.count = (start, end) => {
388
+ countStart.setTime(+start);
389
+ countEnd.setTime(+end);
390
+ floor(countStart);
391
+ floor(countEnd);
392
+ return Math.floor(count(countStart, countEnd));
393
+ };
394
+ interval.every = (step) => {
395
+ step = Math.floor(step);
396
+ if (!Number.isFinite(step) || !(step > 0))
397
+ return null;
398
+ if (step === 1)
399
+ return interval;
400
+ return interval.filter(field ? (date) => field(date) % step === 0 : (date) => interval.count(0, date) % step === 0);
401
+ };
402
+ }
403
+ return interval;
404
+ }
405
+ var countStart = new Date;
406
+ var countEnd = new Date;
407
+ var durationSecond = 1000;
408
+ var durationMinute = durationSecond * 60;
409
+ var durationHour = durationMinute * 60;
410
+ var durationDay = durationHour * 24;
411
+ var durationWeek = durationDay * 7;
412
+ var durationMonth = durationDay * 30;
413
+ var durationYear = durationDay * 365;
414
+ var millisecond = timeInterval(() => {}, (date, step) => {
415
+ date.setTime(+date + step);
416
+ }, (start, end) => {
417
+ return +end - +start;
418
+ });
419
+ millisecond.every = (k) => {
420
+ k = Math.floor(k);
421
+ if (!isFinite(k) || !(k > 0))
422
+ return null;
423
+ if (!(k > 1))
424
+ return millisecond;
425
+ return timeInterval((date) => {
426
+ date.setTime(Math.floor(+date / k) * k);
427
+ }, (date, step) => {
428
+ date.setTime(+date + step * k);
429
+ }, (start, end) => {
430
+ return (+end - +start) / k;
431
+ });
432
+ };
433
+ var milliseconds = millisecond.range;
434
+ var second = timeInterval((date) => {
435
+ date.setTime(+date - date.getMilliseconds());
436
+ }, (date, step) => {
437
+ date.setTime(+date + step * durationSecond);
438
+ }, (start, end) => {
439
+ return (+end - +start) / durationSecond;
440
+ }, (date) => {
441
+ return date.getUTCSeconds();
442
+ });
443
+ var seconds = second.range;
444
+ var timeMinute = timeInterval((date) => {
445
+ date.setTime(+date - date.getMilliseconds() - date.getSeconds() * durationSecond);
446
+ }, (date, step) => {
447
+ date.setTime(+date + step * durationMinute);
448
+ }, (start, end) => {
449
+ return (+end - +start) / durationMinute;
450
+ }, (date) => {
451
+ return date.getMinutes();
452
+ });
453
+ var timeMinutes = timeMinute.range;
454
+ var utcMinute = timeInterval((date) => {
455
+ date.setUTCSeconds(0, 0);
456
+ }, (date, step) => {
457
+ date.setTime(+date + step * durationMinute);
458
+ }, (start, end) => {
459
+ return (+end - +start) / durationMinute;
460
+ }, (date) => {
461
+ return date.getUTCMinutes();
462
+ });
463
+ var utcMinutes = utcMinute.range;
464
+ var timeHour = timeInterval((date) => {
465
+ date.setTime(+date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
466
+ }, (date, step) => {
467
+ date.setTime(+date + step * durationHour);
468
+ }, (start, end) => {
469
+ return (+end - +start) / durationHour;
470
+ }, (date) => {
471
+ return date.getHours();
472
+ });
473
+ var timeHours = timeHour.range;
474
+ var utcHour = timeInterval((date) => {
475
+ date.setUTCMinutes(0, 0, 0);
476
+ }, (date, step) => {
477
+ date.setTime(+date + step * durationHour);
478
+ }, (start, end) => {
479
+ return (+end - +start) / durationHour;
480
+ }, (date) => {
481
+ return date.getUTCHours();
482
+ });
483
+ var utcHours = utcHour.range;
484
+ var timeDay = timeInterval((date) => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (+end - +start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay, (date) => date.getDate() - 1);
485
+ var timeDays = timeDay.range;
486
+ var utcDay = timeInterval((date) => {
487
+ date.setUTCHours(0, 0, 0, 0);
488
+ }, (date, step) => {
489
+ date.setUTCDate(date.getUTCDate() + step);
490
+ }, (start, end) => {
491
+ return (+end - +start) / durationDay;
492
+ }, (date) => {
493
+ return date.getUTCDate() - 1;
494
+ });
495
+ var utcDays = utcDay.range;
496
+ var unixDay = timeInterval((date) => {
497
+ date.setUTCHours(0, 0, 0, 0);
498
+ }, (date, step) => {
499
+ date.setUTCDate(date.getUTCDate() + step);
500
+ }, (start, end) => {
501
+ return (+end - +start) / durationDay;
502
+ }, (date) => {
503
+ return Math.floor(+date / durationDay);
504
+ });
505
+ var unixDays = unixDay.range;
506
+ function timeWeekday(i) {
507
+ return timeInterval((date) => {
508
+ date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
509
+ date.setHours(0, 0, 0, 0);
510
+ }, (date, step) => {
511
+ date.setDate(date.getDate() + step * 7);
512
+ }, (start, end) => {
513
+ return (+end - +start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
514
+ });
515
+ }
516
+ var timeSunday = timeWeekday(0);
517
+ var timeMonday = timeWeekday(1);
518
+ var timeTuesday = timeWeekday(2);
519
+ var timeWednesday = timeWeekday(3);
520
+ var timeThursday = timeWeekday(4);
521
+ var timeFriday = timeWeekday(5);
522
+ var timeSaturday = timeWeekday(6);
523
+ var timeSundays = timeSunday.range;
524
+ var timeMondays = timeMonday.range;
525
+ var timeTuesdays = timeTuesday.range;
526
+ var timeWednesdays = timeWednesday.range;
527
+ var timeThursdays = timeThursday.range;
528
+ var timeFridays = timeFriday.range;
529
+ var timeSaturdays = timeSaturday.range;
530
+ function utcWeekday(i) {
531
+ return timeInterval((date) => {
532
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
533
+ date.setUTCHours(0, 0, 0, 0);
534
+ }, (date, step) => {
535
+ date.setUTCDate(date.getUTCDate() + step * 7);
536
+ }, (start, end) => {
537
+ return (+end - +start) / durationWeek;
538
+ });
539
+ }
540
+ var utcSunday = utcWeekday(0);
541
+ var utcMonday = utcWeekday(1);
542
+ var utcTuesday = utcWeekday(2);
543
+ var utcWednesday = utcWeekday(3);
544
+ var utcThursday = utcWeekday(4);
545
+ var utcFriday = utcWeekday(5);
546
+ var utcSaturday = utcWeekday(6);
547
+ var utcSundays = utcSunday.range;
548
+ var utcMondays = utcMonday.range;
549
+ var utcTuesdays = utcTuesday.range;
550
+ var utcWednesdays = utcWednesday.range;
551
+ var utcThursdays = utcThursday.range;
552
+ var utcFridays = utcFriday.range;
553
+ var utcSaturdays = utcSaturday.range;
554
+ var timeMonth = timeInterval((date) => {
555
+ date.setDate(1);
556
+ date.setHours(0, 0, 0, 0);
557
+ }, (date, step) => {
558
+ date.setMonth(date.getMonth() + step);
559
+ }, (start, end) => {
560
+ return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
561
+ }, (date) => {
562
+ return date.getMonth();
563
+ });
564
+ var timeMonths = timeMonth.range;
565
+ var utcMonth = timeInterval((date) => {
566
+ date.setUTCDate(1);
567
+ date.setUTCHours(0, 0, 0, 0);
568
+ }, (date, step) => {
569
+ date.setUTCMonth(date.getUTCMonth() + step);
570
+ }, (start, end) => {
571
+ return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
572
+ }, (date) => {
573
+ return date.getUTCMonth();
574
+ });
575
+ var utcMonths = utcMonth.range;
576
+ var timeYear = timeInterval((date) => {
577
+ date.setMonth(0, 1);
578
+ date.setHours(0, 0, 0, 0);
579
+ }, (date, step) => {
580
+ date.setFullYear(date.getFullYear() + step);
581
+ }, (start, end) => {
582
+ return end.getFullYear() - start.getFullYear();
583
+ }, (date) => {
584
+ return date.getFullYear();
585
+ });
586
+ timeYear.every = (k) => {
587
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
588
+ date.setFullYear(Math.floor(date.getFullYear() / k) * k);
589
+ date.setMonth(0, 1);
590
+ date.setHours(0, 0, 0, 0);
591
+ }, (date, step) => {
592
+ date.setFullYear(date.getFullYear() + step * k);
593
+ });
594
+ };
595
+ var timeYears = timeYear.range;
596
+ var utcYear = timeInterval((date) => {
597
+ date.setUTCMonth(0, 1);
598
+ date.setUTCHours(0, 0, 0, 0);
599
+ }, (date, step) => {
600
+ date.setUTCFullYear(date.getUTCFullYear() + step);
601
+ }, (start, end) => {
602
+ return end.getUTCFullYear() - start.getUTCFullYear();
603
+ }, (date) => {
604
+ return date.getUTCFullYear();
605
+ });
606
+ utcYear.every = (k) => {
607
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
608
+ date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
609
+ date.setUTCMonth(0, 1);
610
+ date.setUTCHours(0, 0, 0, 0);
611
+ }, (date, step) => {
612
+ date.setUTCFullYear(date.getUTCFullYear() + step * k);
613
+ });
614
+ };
615
+ var utcYears = utcYear.range;
616
+ var e10 = Math.sqrt(50);
617
+ var e5 = Math.sqrt(10);
618
+ var e2 = Math.sqrt(2);
619
+ function tickSpec(start, stop, count) {
620
+ const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
621
+ let i1, i2, inc;
622
+ if (power < 0) {
623
+ inc = Math.pow(10, -power) / factor;
624
+ i1 = Math.round(start * inc);
625
+ i2 = Math.round(stop * inc);
626
+ if (i1 / inc < start)
627
+ ++i1;
628
+ if (i2 / inc > stop)
629
+ --i2;
630
+ inc = -inc;
631
+ } else {
632
+ inc = Math.pow(10, power) * factor;
633
+ i1 = Math.round(start / inc);
634
+ i2 = Math.round(stop / inc);
635
+ if (i1 * inc < start)
636
+ ++i1;
637
+ if (i2 * inc > stop)
638
+ --i2;
639
+ }
640
+ if (i2 < i1 && 0.5 <= count && count < 2)
641
+ return tickSpec(start, stop, count * 2);
642
+ return [i1, i2, inc];
643
+ }
644
+ function tickIncrement(start, stop, count) {
645
+ return tickSpec(start, stop, count)[2];
646
+ }
647
+ function tickStep(start, stop, count) {
648
+ const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
649
+ return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
650
+ }
651
+ function ticker(year, month, week, day, hour, minute) {
652
+ const tickIntervals = [
653
+ [second, 1, durationSecond],
654
+ [second, 5, 5 * durationSecond],
655
+ [second, 15, 15 * durationSecond],
656
+ [second, 30, 30 * durationSecond],
657
+ [minute, 1, durationMinute],
658
+ [minute, 5, 5 * durationMinute],
659
+ [minute, 15, 15 * durationMinute],
660
+ [minute, 30, 30 * durationMinute],
661
+ [hour, 1, durationHour],
662
+ [hour, 3, 3 * durationHour],
663
+ [hour, 6, 6 * durationHour],
664
+ [hour, 12, 12 * durationHour],
665
+ [day, 1, durationDay],
666
+ [day, 2, 2 * durationDay],
667
+ [week, 1, durationWeek],
668
+ [month, 1, durationMonth],
669
+ [month, 3, 3 * durationMonth],
670
+ [year, 1, durationYear]
671
+ ];
672
+ function ticks(start, stop, count) {
673
+ const reverse = +stop < +start;
674
+ if (reverse)
675
+ [start, stop] = [stop, start];
676
+ const interval = typeof count !== "number" ? count : tickInterval(start, stop, count);
677
+ const ticks = interval ? interval.range(start, +stop + 1) : [];
678
+ return reverse ? ticks.reverse() : ticks;
679
+ }
680
+ function tickInterval(start, stop, count) {
681
+ const target = Math.abs(+stop - +start) / count;
682
+ let low = 0;
683
+ let high = tickIntervals.length;
684
+ if (Number.isNaN(target))
685
+ low = high;
686
+ while (low < high) {
687
+ const middle = low + high >>> 1;
688
+ if (tickIntervals[middle][2] <= target)
689
+ low = middle + 1;
690
+ else
691
+ high = middle;
692
+ }
693
+ const i = low;
694
+ if (i === tickIntervals.length)
695
+ return year.every(tickStep(+start / durationYear, +stop / durationYear, count));
696
+ if (i === 0)
697
+ return millisecond.every(Math.max(tickStep(+start, +stop, count), 1));
698
+ const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
699
+ return t.every(step);
700
+ }
701
+ return [ticks, tickInterval];
702
+ }
703
+ var [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);
704
+ var [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
705
+
706
+ // src/react/ui/chart-time.ts
707
+ var day = 86400000;
708
+ function chartTimestamp(value, numeric = false) {
709
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
710
+ return parseDateTime2(`${value}T00:00:00Z`)?.getTime() ?? null;
711
+ }
712
+ if (value instanceof Date || typeof value === "string" || numeric && typeof value === "number") {
713
+ return parseDateTime2(value)?.getTime() ?? null;
714
+ }
715
+ return null;
716
+ }
717
+ function timeModel(values, numeric = false) {
718
+ if (!values.length)
719
+ return null;
720
+ const parsed = values.map((value) => chartTimestamp(value, numeric));
721
+ if (parsed.some((value) => value == null))
722
+ return null;
723
+ const times = [...new Set(parsed)].sort((a, b) => a - b);
724
+ const start = times[0];
725
+ const end = times.at(-1);
726
+ const gaps = times.slice(1).map((value, index) => value - times[index]);
727
+ const precision = gaps.reduce((minimum, gap) => Math.min(minimum, gap), day);
728
+ const dateOnly = values.every((value) => typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value));
729
+ const seconds = times.some((value) => value % 60000 !== 0) || precision < 60000;
730
+ const milliseconds = times.some((value) => value % 1000 !== 0) || precision < 1000;
731
+ function tooltip(value) {
732
+ const time = chartTimestamp(value, true);
733
+ if (time == null)
734
+ return typeof value === "string" || typeof value === "number" ? String(value) : "";
735
+ if (dateOnly)
736
+ return formatDate2(new Date(time).toISOString().slice(0, 10));
737
+ if (milliseconds) {
738
+ return new Intl.DateTimeFormat("en-US", {
739
+ timeZone: "UTC",
740
+ year: "numeric",
741
+ month: "short",
742
+ day: "numeric",
743
+ hour: "2-digit",
744
+ minute: "2-digit",
745
+ second: "2-digit",
746
+ fractionalSecondDigits: 3,
747
+ hourCycle: "h23"
748
+ }).format(time);
749
+ }
750
+ return formatDateTime2(time, {
751
+ precision: seconds ? "second" : "minute",
752
+ timeZone: "UTC"
753
+ });
754
+ }
755
+ return {
756
+ start,
757
+ end,
758
+ times,
759
+ precision: gaps.length ? gaps.reduce((minimum, gap) => Math.min(minimum, gap), Infinity) : day,
760
+ tooltip
761
+ };
762
+ }
763
+ function datePart(value, options) {
764
+ return new Intl.DateTimeFormat("en-US", {
765
+ ...options,
766
+ timeZone: "UTC"
767
+ }).format(value);
768
+ }
769
+ function timeTicks2(model, width) {
770
+ const { start, end } = model;
771
+ const firstDate = new Date(start);
772
+ const lastDate = new Date(end);
773
+ const spansYears = firstDate.getUTCFullYear() !== lastDate.getUTCFullYear();
774
+ const spansDates = firstDate.toISOString().slice(0, 10) !== lastDate.toISOString().slice(0, 10);
775
+ const count = Math.max(2, Math.min(12, Math.floor(width / 80), model.times.length));
776
+ let ticks = start === end ? [start] : utcTicks(new Date(start), new Date(end), Math.min(count, (end - start) / model.precision)).map(Number);
777
+ const step = ticks.length > 1 ? ticks[1] - ticks[0] : Math.max(end - start, model.precision);
778
+ const candidates = [...new Set([start, ...ticks, end])].sort((a, b) => a - b);
779
+ ticks = [start];
780
+ const gap = step < 1000 ? 110 : 80;
781
+ for (const value of candidates.slice(1)) {
782
+ if ((value - ticks.at(-1)) / (end - start) * width >= gap)
783
+ ticks.push(value);
784
+ }
785
+ if (end !== start && ticks.at(-1) !== end) {
786
+ if (ticks.length > 1 && (end - ticks.at(-1)) / (end - start) * width < gap)
787
+ ticks.pop();
788
+ ticks.push(end);
789
+ }
790
+ function label(value, index) {
791
+ const previous = index > 0 ? new Date(ticks[index - 1]) : undefined;
792
+ const date = new Date(value);
793
+ const yearChanged = !previous || previous.getUTCFullYear() !== date.getUTCFullYear();
794
+ const dateChanged = !previous || previous.toISOString().slice(0, 10) !== date.toISOString().slice(0, 10);
795
+ if (step >= 300 * day)
796
+ return { main: String(date.getUTCFullYear()), context: "" };
797
+ if (step >= 28 * day && (model.precision >= 28 * day || end - start >= 180 * day))
798
+ return {
799
+ main: datePart(value, { month: "short" }),
800
+ context: spansYears && yearChanged ? String(date.getUTCFullYear()) : ""
801
+ };
802
+ if (step >= day && !(model.precision < day && end - start <= 3 * day))
803
+ return {
804
+ main: datePart(value, { month: "short", day: "numeric" }),
805
+ context: spansYears && yearChanged ? String(date.getUTCFullYear()) : ""
806
+ };
807
+ return {
808
+ main: datePart(value, {
809
+ hour: "2-digit",
810
+ minute: "2-digit",
811
+ ...step < 60000 ? { second: "2-digit" } : {},
812
+ ...step < 1000 ? { fractionalSecondDigits: 3 } : {},
813
+ hourCycle: "h23"
814
+ }),
815
+ context: spansDates && dateChanged ? datePart(value, {
816
+ month: "short",
817
+ day: "numeric",
818
+ ...spansYears && yearChanged ? { year: "numeric" } : {}
819
+ }) : ""
820
+ };
821
+ }
822
+ return { ticks, label };
823
+ }
824
+
825
+ // src/react/ui/chart-date-axis.tsx
826
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
827
+ var DateAxes = createContext(null);
828
+ function ChartDateAxes({
829
+ data,
830
+ children
831
+ }) {
832
+ const [formatters, setFormatters] = useState(() => new Map);
833
+ const register = useCallback((id, formatter) => {
834
+ setFormatters((current) => new Map(current).set(id, formatter));
835
+ return () => setFormatters((current) => {
836
+ const next = new Map(current);
837
+ next.delete(id);
838
+ return next;
839
+ });
840
+ }, []);
841
+ return /* @__PURE__ */ jsx5(DateAxes.Provider, {
842
+ value: { data, formatters, register },
843
+ children
844
+ });
845
+ }
846
+ function useDateAxisLabel(id = 0) {
847
+ return useContext(DateAxes)?.formatters.get(id);
848
+ }
849
+ function field(row, key) {
850
+ if (row == null || typeof row !== "object")
851
+ return;
852
+ if (key in row)
853
+ return row[key];
854
+ return String(key).replace(/\[(\d+)\]/g, ".$1").split(".").reduce((value, part) => value != null && typeof value === "object" ? value[part] : undefined, row);
855
+ }
856
+ function ChartXAxis(props) {
857
+ const context = useContext(DateAxes);
858
+ const plot = usePlotArea();
859
+ const data = context?.data;
860
+ const dataKey = props.dataKey;
861
+ const numeric = props.scale === "utc";
862
+ const enabled = numeric || props.type == null && props.scale == null && props.tickFormatter == null && props.ticks == null;
863
+ const model = useMemo(() => {
864
+ if (!enabled || !data?.length || dataKey == null)
865
+ return null;
866
+ return timeModel(data.map((row) => typeof dataKey === "function" ? dataKey(row) : field(row, dataKey)), numeric);
867
+ }, [data, dataKey, enabled, numeric]);
868
+ const register = context?.register;
869
+ const id = props.xAxisId ?? 0;
870
+ useEffect(() => model ? register?.(id, model.tooltip) : undefined, [register, id, model]);
871
+ const axis = model ? timeTicks2(model, plot?.width ?? 400) : undefined;
872
+ return /* @__PURE__ */ jsx5(XAxis, {
873
+ stroke: "var(--atbl-muted)",
874
+ tickFormatter: (value) => typeof value === "number" ? formatNumber2(value) : String(value),
875
+ tickLine: false,
876
+ axisLine: { stroke: "var(--atbl-border)" },
877
+ tick: { fontSize: "var(--atbl-type-meta-size)" },
878
+ ...model && axis ? {
879
+ type: "number",
880
+ scale: "utc",
881
+ domain: model.start === model.end ? [
882
+ model.start - model.precision / 2,
883
+ model.end + model.precision / 2
884
+ ] : [model.start, model.end],
885
+ ticks: axis.ticks,
886
+ interval: 0,
887
+ height: 48,
888
+ tick: ({ x, y, payload, index }) => {
889
+ const label = axis.label(Number(payload.value), index);
890
+ return /* @__PURE__ */ jsxs3("text", {
891
+ x,
892
+ y: Number(y) + 5,
893
+ fill: "var(--atbl-muted)",
894
+ fontSize: "var(--atbl-type-meta-size)",
895
+ textAnchor: index === 0 ? "start" : index === axis.ticks.length - 1 ? "end" : "middle",
896
+ children: [
897
+ /* @__PURE__ */ jsx5("tspan", {
898
+ x,
899
+ dy: "0.8em",
900
+ children: label.main
901
+ }),
902
+ label.context && /* @__PURE__ */ jsx5("tspan", {
903
+ x,
904
+ dy: "1.4em",
905
+ children: label.context
906
+ })
907
+ ]
908
+ });
909
+ }
910
+ } : {},
911
+ ...props,
912
+ ...model ? {
913
+ type: "number",
914
+ dataKey: (row) => chartTimestamp(typeof dataKey === "function" ? dataKey(row) : field(row, dataKey), numeric)
915
+ } : {}
916
+ });
917
+ }
918
+
919
+ // src/react/ui/chart-primitives.tsx
920
+ import { useContext as useContext3, useLayoutEffect } from "react";
921
+
922
+ // src/react/ui/chart-interaction.tsx
923
+ import {
924
+ createContext as createContext2,
925
+ useContext as useContext2,
926
+ useId,
927
+ useEffect as useEffect2
928
+ } from "react";
929
+ import { jsx as jsx6 } from "react/jsx-runtime";
930
+ var ChartInteraction = createContext2(null);
931
+ function useChartSeries(id) {
932
+ const generatedId = useId();
933
+ const interaction = useContext2(ChartInteraction);
934
+ const seriesId = id ?? generatedId;
935
+ const registerSeries = interaction?.registerSeries;
936
+ useEffect2(() => registerSeries?.(seriesId), [registerSeries, seriesId]);
937
+ return {
938
+ id: seriesId,
939
+ active: !interaction?.pointer || interaction.seriesCount === 1 || interaction.hovered === seriesId
940
+ };
941
+ }
942
+ function ChartSeries({
943
+ id,
944
+ children
945
+ }) {
946
+ const interaction = useContext2(ChartInteraction);
947
+ return /* @__PURE__ */ jsx6("g", {
948
+ onPointerOver: () => interaction?.setHovered(id),
949
+ onPointerDown: () => interaction?.setHovered(id),
950
+ children
951
+ });
952
+ }
953
+
1094
954
  // src/react/ui/chart-primitives.tsx
1095
955
  import {
1096
956
  Area,
@@ -1098,7 +958,6 @@ import {
1098
958
  Bar,
1099
959
  Line,
1100
960
  Scatter,
1101
- XAxis,
1102
961
  YAxis,
1103
962
  CartesianGrid,
1104
963
  Tooltip,
@@ -1108,26 +967,49 @@ import {
1108
967
  // src/react/ui/ChartLegend.tsx
1109
968
  import {
1110
969
  Children,
1111
- useId,
1112
- useState
970
+ useId as useId2,
971
+ useEffect as useEffect3,
972
+ useRef,
973
+ useState as useState2
1113
974
  } from "react";
1114
- import { jsx as jsx6, jsxs as jsxs4, Fragment } from "react/jsx-runtime";
975
+ import { jsx as jsx7, jsxs as jsxs4, Fragment } from "react/jsx-runtime";
1115
976
  function ChartLegendRoot({
1116
977
  children,
1117
978
  layout = "horizontal",
1118
979
  align = "start",
1119
- maxVisibleItems = 6,
980
+ maxVisibleItems,
1120
981
  className,
1121
982
  "aria-label": ariaLabel = "Chart legend",
1122
983
  ...props
1123
984
  }) {
1124
- const [expanded, setExpanded] = useState(false);
1125
- const listId = useId();
985
+ const [expanded, setExpanded] = useState2(false);
986
+ const listId = useId2();
987
+ const containerRef = useRef(null);
988
+ const [columns, setColumns] = useState2(2);
989
+ useEffect3(() => {
990
+ const container = containerRef.current;
991
+ if (!container)
992
+ return;
993
+ function measure() {
994
+ const list = containerRef.current?.firstElementChild;
995
+ if (list) {
996
+ setColumns(getComputedStyle(list).gridTemplateColumns.split(" ").length);
997
+ }
998
+ }
999
+ const observer = new ResizeObserver(measure);
1000
+ observer.observe(container);
1001
+ measure();
1002
+ return () => observer.disconnect();
1003
+ }, [layout]);
1126
1004
  const items = Children.toArray(children);
1127
- const limit = Number.isFinite(maxVisibleItems) ? Math.max(1, Math.floor(maxVisibleItems)) : 6;
1005
+ const rowCapacity = layout === "vertical" ? 6 : columns * (layout === "single-row" ? 1 : 2);
1006
+ const configuredLimit = typeof maxVisibleItems === "number" && Number.isFinite(maxVisibleItems) ? Math.max(1, Math.floor(maxVisibleItems)) : rowCapacity;
1007
+ const cappedLimit = Math.min(configuredLimit, rowCapacity);
1008
+ const limit = layout === "vertical" ? configuredLimit : cappedLimit >= columns ? Math.floor(cappedLimit / columns) * columns : cappedLimit;
1128
1009
  const visibleCount = items.length > limit ? limit - 1 : limit;
1129
1010
  const hiddenCount = Math.max(0, items.length - visibleCount);
1130
- return /* @__PURE__ */ jsx6("div", {
1011
+ return /* @__PURE__ */ jsx7("div", {
1012
+ ref: containerRef,
1131
1013
  className: "altertable-chart-legend-container",
1132
1014
  children: /* @__PURE__ */ jsxs4("ul", {
1133
1015
  id: listId,
@@ -1138,9 +1020,9 @@ function ChartLegendRoot({
1138
1020
  className: classNames("altertable-chart-legend", className),
1139
1021
  children: [
1140
1022
  expanded ? items : items.slice(0, visibleCount),
1141
- hiddenCount > 0 && /* @__PURE__ */ jsx6("li", {
1023
+ hiddenCount > 0 && /* @__PURE__ */ jsx7("li", {
1142
1024
  className: "altertable-chart-legend-overflow",
1143
- children: /* @__PURE__ */ jsx6("button", {
1025
+ children: /* @__PURE__ */ jsx7("button", {
1144
1026
  type: "button",
1145
1027
  "data-atbl-control": "action",
1146
1028
  "data-atbl-focus": "ring",
@@ -1160,7 +1042,7 @@ function ChartLegendItem({
1160
1042
  className,
1161
1043
  ...props
1162
1044
  }) {
1163
- return /* @__PURE__ */ jsx6("li", {
1045
+ return /* @__PURE__ */ jsx7("li", {
1164
1046
  ...props,
1165
1047
  "data-inactive": inactive || undefined,
1166
1048
  className: classNames("altertable-chart-legend-item", className)
@@ -1168,7 +1050,7 @@ function ChartLegendItem({
1168
1050
  }
1169
1051
  function ChartLegendMarker({
1170
1052
  kind,
1171
- color = kind === "bar" ? chartBarFill : "var(--atbl-accent)",
1053
+ color = kind === "bar" ? chartBarFill : "var(--atbl-chart-1)",
1172
1054
  className,
1173
1055
  style,
1174
1056
  ...props
@@ -1182,16 +1064,16 @@ function ChartLegendMarker({
1182
1064
  className: classNames("altertable-chart-legend-marker", className),
1183
1065
  style: { color, ...style },
1184
1066
  children: [
1185
- kind === "square" && /* @__PURE__ */ jsx6("rect", {
1067
+ kind === "square" && /* @__PURE__ */ jsx7("rect", {
1186
1068
  width: "8",
1187
1069
  height: "8",
1188
1070
  fill: "currentColor"
1189
1071
  }),
1190
- kind === "bar" && /* @__PURE__ */ jsx6("path", {
1072
+ kind === "bar" && /* @__PURE__ */ jsx7("path", {
1191
1073
  d: "M6 11V3Q6 1 8 1H12Q14 1 14 3V11Z",
1192
1074
  fill: "currentColor"
1193
1075
  }),
1194
- kind === "slice" && /* @__PURE__ */ jsx6("rect", {
1076
+ kind === "slice" && /* @__PURE__ */ jsx7("rect", {
1195
1077
  x: "5",
1196
1078
  y: "1",
1197
1079
  width: "10",
@@ -1199,7 +1081,7 @@ function ChartLegendMarker({
1199
1081
  rx: "2",
1200
1082
  fill: "currentColor"
1201
1083
  }),
1202
- kind === "point" && /* @__PURE__ */ jsx6("circle", {
1084
+ kind === "point" && /* @__PURE__ */ jsx7("circle", {
1203
1085
  cx: "10",
1204
1086
  cy: "6",
1205
1087
  r: "3",
@@ -1207,14 +1089,14 @@ function ChartLegendMarker({
1207
1089
  }),
1208
1090
  kind === "line" && /* @__PURE__ */ jsxs4(Fragment, {
1209
1091
  children: [
1210
- /* @__PURE__ */ jsx6("path", {
1092
+ /* @__PURE__ */ jsx7("path", {
1211
1093
  d: "M1 6H19",
1212
1094
  fill: "none",
1213
1095
  stroke: "currentColor",
1214
1096
  strokeWidth: "2",
1215
1097
  strokeLinecap: "round"
1216
1098
  }),
1217
- /* @__PURE__ */ jsx6("circle", {
1099
+ /* @__PURE__ */ jsx7("circle", {
1218
1100
  cx: "10",
1219
1101
  cy: "6",
1220
1102
  r: "2.5",
@@ -1226,12 +1108,12 @@ function ChartLegendMarker({
1226
1108
  }),
1227
1109
  kind === "area" && /* @__PURE__ */ jsxs4(Fragment, {
1228
1110
  children: [
1229
- /* @__PURE__ */ jsx6("path", {
1111
+ /* @__PURE__ */ jsx7("path", {
1230
1112
  d: "M1 10L7 5L13 7L19 2V11H1Z",
1231
1113
  fill: "currentColor",
1232
1114
  fillOpacity: "0.14"
1233
1115
  }),
1234
- /* @__PURE__ */ jsx6("path", {
1116
+ /* @__PURE__ */ jsx7("path", {
1235
1117
  d: "M1 10L7 5L13 7L19 2",
1236
1118
  fill: "none",
1237
1119
  stroke: "currentColor",
@@ -1250,7 +1132,7 @@ function ChartLegendLabel({
1250
1132
  title,
1251
1133
  ...props
1252
1134
  }) {
1253
- return /* @__PURE__ */ jsx6("span", {
1135
+ return /* @__PURE__ */ jsx7("span", {
1254
1136
  ...props,
1255
1137
  title: title ?? (typeof children === "string" ? children : undefined),
1256
1138
  className: classNames("altertable-chart-legend-label", className),
@@ -1264,16 +1146,16 @@ var ChartLegend = Object.assign(ChartLegendRoot, {
1264
1146
  });
1265
1147
 
1266
1148
  // src/react/ui/chart-primitives.tsx
1267
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1268
- var accent = "var(--atbl-accent)";
1149
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1150
+ var seriesColor = "var(--atbl-chart-1)";
1269
1151
  function ChartDot({
1270
1152
  active = false,
1271
- stroke = accent,
1153
+ stroke = seriesColor,
1272
1154
  fill = active ? stroke : "var(--atbl-surface)",
1273
1155
  r = active ? 4.5 : 3,
1274
1156
  ...props
1275
1157
  }) {
1276
- return /* @__PURE__ */ jsx7(Dot, {
1158
+ return /* @__PURE__ */ jsx8(Dot, {
1277
1159
  stroke,
1278
1160
  fill,
1279
1161
  r,
@@ -1281,92 +1163,126 @@ function ChartDot({
1281
1163
  ...props
1282
1164
  });
1283
1165
  }
1166
+ function NearestChartDot({
1167
+ seriesId,
1168
+ cx,
1169
+ cy,
1170
+ stroke
1171
+ }) {
1172
+ const interaction = useContext3(ChartInteraction);
1173
+ const registerPoint = interaction?.registerPoint;
1174
+ useLayoutEffect(() => {
1175
+ if (cx == null || cy == null)
1176
+ return;
1177
+ return registerPoint?.(seriesId, cx, cy);
1178
+ }, [registerPoint, seriesId, cx, cy]);
1179
+ const active = !interaction?.pointer || interaction.seriesCount === 1 || interaction.hovered === seriesId;
1180
+ return active ? /* @__PURE__ */ jsx8(ChartDot, {
1181
+ cx,
1182
+ cy,
1183
+ stroke,
1184
+ active: true,
1185
+ style: { pointerEvents: "none" }
1186
+ }) : null;
1187
+ }
1284
1188
  function ChartBar(props) {
1285
- return /* @__PURE__ */ jsx7(Bar, {
1286
- fill: chartBarFill,
1287
- radius: [5, 5, 0, 0],
1288
- maxBarSize: 30,
1289
- activeBar: { fill: accent },
1290
- isAnimationActive: false,
1291
- ...props
1189
+ const series = useChartSeries(props.id);
1190
+ return /* @__PURE__ */ jsx8(ChartSeries, {
1191
+ id: series.id,
1192
+ children: /* @__PURE__ */ jsx8(Bar, {
1193
+ fill: chartBarFill,
1194
+ radius: props.stackId == null ? [5, 5, 0, 0] : 0,
1195
+ maxBarSize: 30,
1196
+ activeBar: series.active ? { opacity: 0.75 } : false,
1197
+ isAnimationActive: false,
1198
+ ...props,
1199
+ id: series.id
1200
+ })
1292
1201
  });
1293
1202
  }
1294
1203
  function ChartLine({
1295
- stroke = accent,
1296
- dot,
1204
+ stroke = seriesColor,
1205
+ dot = false,
1297
1206
  activeDot,
1298
1207
  ...props
1299
1208
  }) {
1300
- return /* @__PURE__ */ jsx7(Line, {
1301
- type: "linear",
1302
- stroke,
1303
- strokeWidth: 2,
1304
- strokeLinecap: "round",
1305
- strokeLinejoin: "round",
1306
- dot: dot === undefined || dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx7(ChartDot, {
1307
- cx,
1308
- cy,
1309
- stroke
1310
- }) : dot,
1311
- activeDot: activeDot === undefined || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx7(ChartDot, {
1312
- cx,
1313
- cy,
1209
+ const series = useChartSeries(props.id);
1210
+ return /* @__PURE__ */ jsx8(ChartSeries, {
1211
+ id: series.id,
1212
+ children: /* @__PURE__ */ jsx8(Line, {
1213
+ type: "linear",
1314
1214
  stroke,
1315
- active: true
1316
- }) : activeDot,
1317
- isAnimationActive: false,
1318
- ...props
1215
+ strokeWidth: 2,
1216
+ strokeLinecap: "round",
1217
+ strokeLinejoin: "round",
1218
+ dot: dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx8(ChartDot, {
1219
+ cx,
1220
+ cy,
1221
+ stroke
1222
+ }) : dot,
1223
+ activeDot: activeDot === undefined || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx8(NearestChartDot, {
1224
+ seriesId: series.id,
1225
+ cx,
1226
+ cy,
1227
+ stroke
1228
+ }) : activeDot,
1229
+ isAnimationActive: false,
1230
+ ...props,
1231
+ id: series.id
1232
+ })
1319
1233
  });
1320
1234
  }
1321
1235
  function ChartArea({
1322
- stroke = accent,
1323
- dot,
1236
+ stroke = seriesColor,
1237
+ dot = false,
1324
1238
  activeDot,
1325
1239
  ...props
1326
1240
  }) {
1327
- return /* @__PURE__ */ jsx7(Area, {
1328
- legendType: "square",
1329
- type: "linear",
1330
- stroke,
1331
- strokeWidth: 2,
1332
- strokeLinecap: "round",
1333
- strokeLinejoin: "round",
1334
- fill: stroke,
1335
- fillOpacity: 0.14,
1336
- dot: dot === undefined || dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx7(ChartDot, {
1337
- cx,
1338
- cy,
1339
- stroke
1340
- }) : dot,
1341
- activeDot: activeDot === undefined || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx7(ChartDot, {
1342
- cx,
1343
- cy,
1241
+ const series = useChartSeries(props.id);
1242
+ return /* @__PURE__ */ jsx8(ChartSeries, {
1243
+ id: series.id,
1244
+ children: /* @__PURE__ */ jsx8(Area, {
1245
+ legendType: "square",
1246
+ type: "linear",
1344
1247
  stroke,
1345
- active: true
1346
- }) : activeDot,
1347
- isAnimationActive: false,
1348
- ...props
1248
+ strokeWidth: 2,
1249
+ strokeLinecap: "round",
1250
+ strokeLinejoin: "round",
1251
+ fill: stroke,
1252
+ fillOpacity: 0.14,
1253
+ dot: dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx8(ChartDot, {
1254
+ cx,
1255
+ cy,
1256
+ stroke
1257
+ }) : dot,
1258
+ activeDot: activeDot === undefined || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx8(NearestChartDot, {
1259
+ seriesId: series.id,
1260
+ cx,
1261
+ cy,
1262
+ stroke
1263
+ }) : activeDot,
1264
+ isAnimationActive: false,
1265
+ ...props,
1266
+ id: series.id
1267
+ })
1349
1268
  });
1350
1269
  }
1351
1270
  function ChartScatter(props) {
1352
- return /* @__PURE__ */ jsx7(Scatter, {
1353
- fill: accent,
1354
- isAnimationActive: false,
1355
- ...props
1356
- });
1357
- }
1358
- function ChartXAxis(props) {
1359
- return /* @__PURE__ */ jsx7(XAxis, {
1360
- stroke: "var(--atbl-muted)",
1361
- tickLine: false,
1362
- axisLine: { stroke: "var(--atbl-border)" },
1363
- tick: { fontSize: "var(--atbl-type-meta-size)" },
1364
- ...props
1271
+ const series = useChartSeries(props.id);
1272
+ return /* @__PURE__ */ jsx8(ChartSeries, {
1273
+ id: series.id,
1274
+ children: /* @__PURE__ */ jsx8(Scatter, {
1275
+ fill: seriesColor,
1276
+ isAnimationActive: false,
1277
+ ...props,
1278
+ id: series.id
1279
+ })
1365
1280
  });
1366
1281
  }
1367
1282
  function ChartYAxis(props) {
1368
- return /* @__PURE__ */ jsx7(YAxis, {
1283
+ return /* @__PURE__ */ jsx8(YAxis, {
1369
1284
  stroke: "var(--atbl-muted)",
1285
+ tickFormatter: (value) => typeof value === "number" ? formatNumber2(value) : String(value),
1370
1286
  tickLine: false,
1371
1287
  axisLine: false,
1372
1288
  tick: { fontSize: "var(--atbl-type-meta-size)" },
@@ -1374,19 +1290,19 @@ function ChartYAxis(props) {
1374
1290
  });
1375
1291
  }
1376
1292
  function ChartGrid(props) {
1377
- return /* @__PURE__ */ jsx7(CartesianGrid, {
1293
+ return /* @__PURE__ */ jsx8(CartesianGrid, {
1378
1294
  stroke: "var(--atbl-border)",
1379
1295
  vertical: false,
1380
1296
  ...props
1381
1297
  });
1382
1298
  }
1383
1299
  function ChartTooltipContent(props) {
1384
- if (!props.active)
1300
+ if (!props.active || !props.payload?.length)
1385
1301
  return null;
1386
- return /* @__PURE__ */ jsx7(TooltipSurface, {
1302
+ return /* @__PURE__ */ jsx8(TooltipSurface, {
1387
1303
  "data-variant": "chart",
1388
1304
  role: "tooltip",
1389
- children: /* @__PURE__ */ jsx7(DefaultTooltipContent, {
1305
+ children: /* @__PURE__ */ jsx8(DefaultTooltipContent, {
1390
1306
  ...props,
1391
1307
  separator: "",
1392
1308
  payload: props.payload?.map((entry) => ({
@@ -1394,7 +1310,7 @@ function ChartTooltipContent(props) {
1394
1310
  unit: undefined,
1395
1311
  formatter: (value, name, _item, index, payload) => {
1396
1312
  const formatter = entry.formatter ?? props.formatter;
1397
- const formatted = formatter ? formatter(value, name, entry, index, props.payload ?? payload) : Array.isArray(value) ? value.join(" ~ ") : value;
1313
+ const formatted = formatter ? formatter(value, name, entry, index, props.payload ?? payload) : Array.isArray(value) ? value.map((item) => typeof item === "number" ? formatNumber2(item) : item).join(" ~ ") : typeof value === "number" ? formatNumber2(value) : value;
1398
1314
  if (formatted == null)
1399
1315
  return null;
1400
1316
  const [displayValue, displayName] = Array.isArray(formatted) ? formatted : [formatted, name];
@@ -1402,10 +1318,10 @@ function ChartTooltipContent(props) {
1402
1318
  /* @__PURE__ */ jsxs5("span", {
1403
1319
  className: "altertable-chart-tooltip-row",
1404
1320
  children: [
1405
- /* @__PURE__ */ jsx7(ChartLegend.Marker, {
1321
+ /* @__PURE__ */ jsx8(ChartLegend.Marker, {
1406
1322
  kind: "square",
1407
1323
  className: "altertable-chart-tooltip-marker",
1408
- color: entry.color ?? entry.stroke ?? entry.fill ?? "var(--atbl-accent)"
1324
+ color: entry.color ?? entry.stroke ?? entry.fill ?? "var(--atbl-chart-1)"
1409
1325
  }),
1410
1326
  /* @__PURE__ */ jsxs5("span", {
1411
1327
  className: "altertable-chart-tooltip-reading",
@@ -1447,8 +1363,15 @@ function ChartTooltipContent(props) {
1447
1363
  });
1448
1364
  }
1449
1365
  function ChartTooltip(props) {
1450
- return /* @__PURE__ */ jsx7(Tooltip, {
1451
- content: /* @__PURE__ */ jsx7(ChartTooltipContent, {}),
1366
+ const dateLabel = useDateAxisLabel(props.axisId);
1367
+ const interaction = useContext3(ChartInteraction);
1368
+ return /* @__PURE__ */ jsx8(Tooltip, {
1369
+ labelFormatter: dateLabel,
1370
+ content: (content) => /* @__PURE__ */ jsx8(ChartTooltipContent, {
1371
+ ...content,
1372
+ payload: interaction?.pointer && interaction.seriesCount !== 1 && props.shared !== true ? content.payload.filter((entry) => entry.graphicalItemId === interaction.hovered) : content.payload
1373
+ }),
1374
+ position: interaction?.pointer && interaction.point ? { y: interaction.point.y } : undefined,
1452
1375
  cursor: false,
1453
1376
  isAnimationActive: false,
1454
1377
  ...props
@@ -1474,19 +1397,19 @@ function validateChartItems(kind, items) {
1474
1397
  }
1475
1398
 
1476
1399
  // src/react/ui/TrendChart.tsx
1477
- import { jsx as jsx8, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
1400
+ import { jsx as jsx9, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
1478
1401
  function TrendChart({
1479
1402
  items,
1480
1403
  unit,
1481
1404
  ariaLabel,
1482
- formatValue = (value) => new Intl.NumberFormat().format(value),
1405
+ formatValue = formatNumber2,
1483
1406
  area = false
1484
1407
  }) {
1485
1408
  validateChartItems(area ? "area" : "line", items);
1486
1409
  const Plot = area ? RechartsAreaChart : RechartsLineChart;
1487
- const [activeIndex, setActiveIndex] = useState2();
1488
- const scrollport = useRef(null);
1489
- useLayoutEffect(() => {
1410
+ const [activeIndex, setActiveIndex] = useState3();
1411
+ const scrollport = useRef2(null);
1412
+ useLayoutEffect2(() => {
1490
1413
  const element = scrollport.current;
1491
1414
  if (element)
1492
1415
  element.scrollLeft = element.scrollWidth - element.clientWidth;
@@ -1498,18 +1421,18 @@ function TrendChart({
1498
1421
  className: "altertable-trend-chart",
1499
1422
  "aria-label": ariaLabel,
1500
1423
  children: [
1501
- items.length === 0 && /* @__PURE__ */ jsx8("span", {
1424
+ items.length === 0 && /* @__PURE__ */ jsx9("span", {
1502
1425
  children: "No data"
1503
1426
  }),
1504
- items.length > 0 && /* @__PURE__ */ jsx8(Fragment2, {
1505
- children: /* @__PURE__ */ jsx8("div", {
1427
+ items.length > 0 && /* @__PURE__ */ jsx9(Fragment2, {
1428
+ children: /* @__PURE__ */ jsx9("div", {
1506
1429
  className: "altertable-trend-scroll",
1507
1430
  ref: scrollport,
1508
1431
  children: /* @__PURE__ */ jsxs6("div", {
1509
1432
  className: "altertable-trend-plot",
1510
1433
  style: { minWidth: items.length * 40 },
1511
1434
  children: [
1512
- /* @__PURE__ */ jsx8("div", {
1435
+ /* @__PURE__ */ jsx9("div", {
1513
1436
  className: "altertable-chart-canvas",
1514
1437
  "aria-hidden": "true",
1515
1438
  children: /* @__PURE__ */ jsxs6(Plot, {
@@ -1517,7 +1440,6 @@ function TrendChart({
1517
1440
  ...item,
1518
1441
  plotValue: item.value / magnitude
1519
1442
  })),
1520
- title: ariaLabel,
1521
1443
  responsive: true,
1522
1444
  width: "100%",
1523
1445
  height: 220,
@@ -1525,46 +1447,46 @@ function TrendChart({
1525
1447
  accessibilityLayer: false,
1526
1448
  tabIndex: -1,
1527
1449
  children: [
1528
- /* @__PURE__ */ jsx8(ChartXAxis, {
1450
+ /* @__PURE__ */ jsx9(ChartXAxis, {
1529
1451
  hide: true,
1530
1452
  dataKey: "id",
1531
1453
  scale: "band"
1532
1454
  }),
1533
- /* @__PURE__ */ jsx8(ChartYAxis, {
1455
+ /* @__PURE__ */ jsx9(ChartYAxis, {
1534
1456
  hide: true,
1535
1457
  domain: [low, high === low ? low + 1 : high]
1536
1458
  }),
1537
- /* @__PURE__ */ jsx8(ReferenceLine, {
1459
+ /* @__PURE__ */ jsx9(ReferenceLine, {
1538
1460
  y: 0,
1539
1461
  stroke: "var(--atbl-border)"
1540
1462
  }),
1541
- area && /* @__PURE__ */ jsx8(ChartArea, {
1463
+ area && /* @__PURE__ */ jsx9(ChartArea, {
1542
1464
  dataKey: "plotValue",
1543
1465
  stroke: "none",
1544
- fill: "var(--atbl-accent)",
1466
+ fill: "var(--atbl-chart-1)",
1545
1467
  dot: false,
1546
1468
  activeDot: false
1547
1469
  }),
1548
- /* @__PURE__ */ jsx8(ChartLine, {
1470
+ /* @__PURE__ */ jsx9(ChartLine, {
1549
1471
  dataKey: "plotValue",
1550
- dot: ({ cx, cy, index }) => /* @__PURE__ */ jsx8(ChartDot, {
1472
+ dot: ({ cx, cy, index }) => index === activeIndex ? /* @__PURE__ */ jsx9(ChartDot, {
1551
1473
  cx,
1552
1474
  cy,
1553
1475
  active: index === activeIndex
1554
- }),
1476
+ }) : /* @__PURE__ */ jsx9("g", {}),
1555
1477
  activeDot: false
1556
1478
  })
1557
1479
  ]
1558
1480
  })
1559
1481
  }),
1560
- /* @__PURE__ */ jsx8("div", {
1482
+ /* @__PURE__ */ jsx9("div", {
1561
1483
  className: "altertable-trend-points",
1562
- children: items.map((item, index) => /* @__PURE__ */ jsx8(Tooltip2, {
1484
+ children: items.map((item, index) => /* @__PURE__ */ jsx9(Tooltip2, {
1563
1485
  variant: "chart",
1564
1486
  onOpenChange: (open) => setActiveIndex((current) => open ? index : current === index ? undefined : current),
1565
1487
  content: /* @__PURE__ */ jsxs6(Fragment2, {
1566
1488
  children: [
1567
- /* @__PURE__ */ jsx8("strong", {
1489
+ /* @__PURE__ */ jsx9("strong", {
1568
1490
  children: item.label
1569
1491
  }),
1570
1492
  /* @__PURE__ */ jsxs6("span", {
@@ -1585,10 +1507,10 @@ function TrendChart({
1585
1507
  className: "altertable-trend-point",
1586
1508
  "aria-label": `${item.label}: ${formatValue(item.value)} ${unit}`,
1587
1509
  children: [
1588
- /* @__PURE__ */ jsx8("span", {
1510
+ /* @__PURE__ */ jsx9("span", {
1589
1511
  className: "altertable-trend-hit"
1590
1512
  }),
1591
- /* @__PURE__ */ jsx8("span", {
1513
+ /* @__PURE__ */ jsx9("span", {
1592
1514
  className: "altertable-trend-label",
1593
1515
  children: item.label
1594
1516
  })
@@ -1605,23 +1527,23 @@ function TrendChart({
1605
1527
  }
1606
1528
 
1607
1529
  // src/react/ui/LineChart.tsx
1608
- import { jsx as jsx9 } from "react/jsx-runtime";
1530
+ import { jsx as jsx10 } from "react/jsx-runtime";
1609
1531
  function LineChart(props) {
1610
- return /* @__PURE__ */ jsx9(TrendChart, {
1532
+ return /* @__PURE__ */ jsx10(TrendChart, {
1611
1533
  ...props
1612
1534
  });
1613
1535
  }
1614
1536
  // src/react/ui/AreaChart.tsx
1615
- import { jsx as jsx10 } from "react/jsx-runtime";
1537
+ import { jsx as jsx11 } from "react/jsx-runtime";
1616
1538
  function AreaChart(props) {
1617
- return /* @__PURE__ */ jsx10(TrendChart, {
1539
+ return /* @__PURE__ */ jsx11(TrendChart, {
1618
1540
  ...props,
1619
1541
  area: true
1620
1542
  });
1621
1543
  }
1622
1544
  // src/react/ui/PieChart.tsx
1623
- import { useState as useState3 } from "react";
1624
- import { jsx as jsx11, jsxs as jsxs7, Fragment as Fragment3 } from "react/jsx-runtime";
1545
+ import { useState as useState4 } from "react";
1546
+ import { jsx as jsx12, jsxs as jsxs7, Fragment as Fragment3 } from "react/jsx-runtime";
1625
1547
  function PieChart({
1626
1548
  items,
1627
1549
  unit,
@@ -1630,9 +1552,9 @@ function PieChart({
1630
1552
  formatValue = (value) => new Intl.NumberFormat().format(value)
1631
1553
  }) {
1632
1554
  validateChartItems("pie", items);
1633
- const [previewId, setPreviewId] = useState3(null);
1634
- const [plotOpen, setPlotOpen] = useState3(false);
1635
- const [legendId, setLegendId] = useState3(null);
1555
+ const [previewId, setPreviewId] = useState4(null);
1556
+ const [plotOpen, setPlotOpen] = useState4(false);
1557
+ const [legendId, setLegendId] = useState4(null);
1636
1558
  const maximum = items.reduce((max, item) => Math.max(max, item.value), 0);
1637
1559
  const total = maximum ? items.reduce((sum, item) => sum + item.value / maximum, 0) : 0;
1638
1560
  let cursor = -Math.PI / 2;
@@ -1661,7 +1583,7 @@ function PieChart({
1661
1583
  function detail(item) {
1662
1584
  return /* @__PURE__ */ jsxs7(Fragment3, {
1663
1585
  children: [
1664
- /* @__PURE__ */ jsx11("strong", {
1586
+ /* @__PURE__ */ jsx12("strong", {
1665
1587
  children: item.label
1666
1588
  }),
1667
1589
  /* @__PURE__ */ jsxs7("span", {
@@ -1681,7 +1603,7 @@ function PieChart({
1681
1603
  className: "altertable-pie-chart",
1682
1604
  "aria-label": ariaLabel,
1683
1605
  children: [
1684
- items.length === 0 && /* @__PURE__ */ jsx11("span", {
1606
+ items.length === 0 && /* @__PURE__ */ jsx12("span", {
1685
1607
  children: "No data"
1686
1608
  }),
1687
1609
  items.length > 0 && /* @__PURE__ */ jsxs7(Fragment3, {
@@ -1689,21 +1611,21 @@ function PieChart({
1689
1611
  /* @__PURE__ */ jsxs7("div", {
1690
1612
  className: "altertable-pie-plot",
1691
1613
  children: [
1692
- /* @__PURE__ */ jsx11(Tooltip2, {
1614
+ /* @__PURE__ */ jsx12(Tooltip2, {
1693
1615
  variant: "chart",
1694
1616
  className: "altertable-pie-tooltip",
1695
1617
  onOpenChange: setPlotOpen,
1696
1618
  content: preview ? detail(preview) : null,
1697
- children: /* @__PURE__ */ jsx11("svg", {
1619
+ children: /* @__PURE__ */ jsx12("svg", {
1698
1620
  viewBox: "0 0 220 220",
1699
1621
  "aria-hidden": "true",
1700
1622
  focusable: "false",
1701
- children: total === 0 ? /* @__PURE__ */ jsx11("circle", {
1623
+ children: total === 0 ? /* @__PURE__ */ jsx12("circle", {
1702
1624
  cx: "110",
1703
1625
  cy: "110",
1704
1626
  r: "100",
1705
1627
  className: "altertable-pie-empty"
1706
- }) : slices.filter((item) => item.share > 0).map((item) => /* @__PURE__ */ jsx11("path", {
1628
+ }) : slices.filter((item) => item.share > 0).map((item) => /* @__PURE__ */ jsx12("path", {
1707
1629
  d: item.path,
1708
1630
  fill: item.color,
1709
1631
  className: "altertable-pie-slice",
@@ -1724,18 +1646,18 @@ function PieChart({
1724
1646
  }, item.id))
1725
1647
  })
1726
1648
  }),
1727
- total === 0 && /* @__PURE__ */ jsx11("span", {
1649
+ total === 0 && /* @__PURE__ */ jsx12("span", {
1728
1650
  className: "altertable-pie-empty-label",
1729
1651
  children: "No nonzero values"
1730
1652
  })
1731
1653
  ]
1732
1654
  }),
1733
- showLegend && /* @__PURE__ */ jsx11(ChartLegend, {
1655
+ showLegend && /* @__PURE__ */ jsx12(ChartLegend, {
1734
1656
  layout: "vertical",
1735
1657
  "aria-label": `${ariaLabel} legend`,
1736
1658
  className: "altertable-pie-legend",
1737
- children: slices.map((item) => /* @__PURE__ */ jsx11(ChartLegend.Item, {
1738
- children: /* @__PURE__ */ jsx11(Tooltip2, {
1659
+ children: slices.map((item) => /* @__PURE__ */ jsx12(ChartLegend.Item, {
1660
+ children: /* @__PURE__ */ jsx12(Tooltip2, {
1739
1661
  variant: "chart",
1740
1662
  content: detail(item),
1741
1663
  onOpenChange: (open) => setLegendId((current) => open ? item.id : current === item.id ? null : current),
@@ -1746,18 +1668,18 @@ function PieChart({
1746
1668
  tabIndex: -1,
1747
1669
  "aria-label": `${item.label}: ${formatValue(item.value)} ${unit}, ${percent(item.share)}`,
1748
1670
  children: [
1749
- /* @__PURE__ */ jsx11(ChartLegend.Marker, {
1671
+ /* @__PURE__ */ jsx12(ChartLegend.Marker, {
1750
1672
  kind: "square",
1751
1673
  color: item.color
1752
1674
  }),
1753
- /* @__PURE__ */ jsx11(ChartLegend.Label, {
1675
+ /* @__PURE__ */ jsx12(ChartLegend.Label, {
1754
1676
  className: "altertable-pie-label",
1755
1677
  children: item.label
1756
1678
  }),
1757
- /* @__PURE__ */ jsx11("strong", {
1679
+ /* @__PURE__ */ jsx12("strong", {
1758
1680
  children: formatValue(item.value)
1759
1681
  }),
1760
- /* @__PURE__ */ jsx11("span", {
1682
+ /* @__PURE__ */ jsx12("span", {
1761
1683
  children: percent(item.share)
1762
1684
  })
1763
1685
  ]
@@ -1771,7 +1693,7 @@ function PieChart({
1771
1693
  });
1772
1694
  }
1773
1695
  // src/react/ui/ScatterChart.tsx
1774
- import { jsx as jsx12, jsxs as jsxs8, Fragment as Fragment4 } from "react/jsx-runtime";
1696
+ import { jsx as jsx13, jsxs as jsxs8, Fragment as Fragment4 } from "react/jsx-runtime";
1775
1697
  function formatNumber(value) {
1776
1698
  return new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 }).format(value);
1777
1699
  }
@@ -1804,7 +1726,7 @@ function ScatterChart({
1804
1726
  className: "altertable-scatter-chart",
1805
1727
  "aria-label": ariaLabel,
1806
1728
  children: [
1807
- items.length === 0 && /* @__PURE__ */ jsx12("span", {
1729
+ items.length === 0 && /* @__PURE__ */ jsx13("span", {
1808
1730
  children: "No data"
1809
1731
  }),
1810
1732
  items.length > 0 && /* @__PURE__ */ jsxs8(Fragment4, {
@@ -1816,21 +1738,21 @@ function ScatterChart({
1816
1738
  yUnit && ` (${yUnit})`
1817
1739
  ]
1818
1740
  }),
1819
- /* @__PURE__ */ jsx12("div", {
1741
+ /* @__PURE__ */ jsx13("div", {
1820
1742
  className: "altertable-scatter-axes",
1821
1743
  children: /* @__PURE__ */ jsxs8("div", {
1822
1744
  className: "altertable-scatter-plot",
1823
1745
  children: [
1824
- yScale.ticks.map((value, index) => /* @__PURE__ */ jsx12("div", {
1746
+ yScale.ticks.map((value, index) => /* @__PURE__ */ jsx13("div", {
1825
1747
  className: "altertable-scatter-gridline",
1826
1748
  style: { bottom: `${index * 50}%` },
1827
1749
  "aria-hidden": "true",
1828
- children: /* @__PURE__ */ jsx12("span", {
1750
+ children: /* @__PURE__ */ jsx13("span", {
1829
1751
  title: formatY(value),
1830
1752
  children: formatY(value)
1831
1753
  })
1832
1754
  }, index)),
1833
- xScale.ticks.map((value, index) => /* @__PURE__ */ jsx12("span", {
1755
+ xScale.ticks.map((value, index) => /* @__PURE__ */ jsx13("span", {
1834
1756
  className: "altertable-scatter-x-tick",
1835
1757
  "data-edge": index,
1836
1758
  style: { left: `${index * 50}%` },
@@ -1838,11 +1760,11 @@ function ScatterChart({
1838
1760
  title: formatX(value),
1839
1761
  children: formatX(value)
1840
1762
  }, index)),
1841
- items.map((item) => /* @__PURE__ */ jsx12(Tooltip2, {
1763
+ items.map((item) => /* @__PURE__ */ jsx13(Tooltip2, {
1842
1764
  variant: "chart",
1843
1765
  content: /* @__PURE__ */ jsxs8(Fragment4, {
1844
1766
  children: [
1845
- /* @__PURE__ */ jsx12("strong", {
1767
+ /* @__PURE__ */ jsx13("strong", {
1846
1768
  children: item.label
1847
1769
  }),
1848
1770
  /* @__PURE__ */ jsxs8("span", {
@@ -1870,14 +1792,14 @@ function ScatterChart({
1870
1792
  left: `${xScale.position(item.x)}%`,
1871
1793
  bottom: `${yScale.position(item.y)}%`
1872
1794
  },
1873
- children: /* @__PURE__ */ jsx12("button", {
1795
+ children: /* @__PURE__ */ jsx13("button", {
1874
1796
  "data-atbl-focus": "ring",
1875
1797
  "data-atbl-control": "default",
1876
1798
  type: "button",
1877
1799
  tabIndex: -1,
1878
1800
  className: "altertable-scatter-point",
1879
1801
  "aria-label": `${item.label}: ${xLabel} ${formatX(item.x)} ${xUnit}, ${yLabel} ${formatY(item.y)} ${yUnit}`,
1880
- children: /* @__PURE__ */ jsx12("span", {})
1802
+ children: /* @__PURE__ */ jsx13("span", {})
1881
1803
  })
1882
1804
  }, item.id))
1883
1805
  ]
@@ -1896,19 +1818,19 @@ function ScatterChart({
1896
1818
  });
1897
1819
  }
1898
1820
  // src/react/ui/BarChart.tsx
1899
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState4 } from "react";
1821
+ import { useLayoutEffect as useLayoutEffect3, useRef as useRef3, useState as useState5 } from "react";
1900
1822
  import { BarChart as RechartsBarChart, Cell } from "recharts";
1901
- import { jsx as jsx13, jsxs as jsxs9, Fragment as Fragment5 } from "react/jsx-runtime";
1823
+ import { jsx as jsx14, jsxs as jsxs9, Fragment as Fragment5 } from "react/jsx-runtime";
1902
1824
  function BarChart({
1903
1825
  items,
1904
1826
  unit,
1905
1827
  ariaLabel,
1906
- formatValue = (value) => new Intl.NumberFormat().format(value)
1828
+ formatValue = formatNumber2
1907
1829
  }) {
1908
1830
  validateChartItems("bar", items);
1909
- const [activeId, setActiveId] = useState4();
1910
- const scrollport = useRef2(null);
1911
- useLayoutEffect2(() => {
1831
+ const [activeId, setActiveId] = useState5();
1832
+ const scrollport = useRef3(null);
1833
+ useLayoutEffect3(() => {
1912
1834
  const element = scrollport.current;
1913
1835
  if (element)
1914
1836
  element.scrollLeft = element.scrollWidth - element.clientWidth;
@@ -1918,17 +1840,17 @@ function BarChart({
1918
1840
  className: "altertable-selectable-bars",
1919
1841
  "aria-label": ariaLabel,
1920
1842
  children: [
1921
- items.length === 0 && /* @__PURE__ */ jsx13("span", {
1843
+ items.length === 0 && /* @__PURE__ */ jsx14("span", {
1922
1844
  children: "No data"
1923
1845
  }),
1924
- /* @__PURE__ */ jsx13("div", {
1846
+ /* @__PURE__ */ jsx14("div", {
1925
1847
  className: "altertable-selectable-bars-scroll",
1926
1848
  ref: scrollport,
1927
1849
  children: /* @__PURE__ */ jsxs9("div", {
1928
1850
  className: "altertable-selectable-bars-plot",
1929
1851
  style: { minWidth: items.length * 45 },
1930
1852
  children: [
1931
- /* @__PURE__ */ jsx13("div", {
1853
+ /* @__PURE__ */ jsx14("div", {
1932
1854
  className: "altertable-chart-canvas",
1933
1855
  "aria-hidden": "true",
1934
1856
  children: /* @__PURE__ */ jsxs9(RechartsBarChart, {
@@ -1936,7 +1858,6 @@ function BarChart({
1936
1858
  ...item,
1937
1859
  plotValue: item.value / maximum
1938
1860
  })),
1939
- title: ariaLabel,
1940
1861
  responsive: true,
1941
1862
  width: "100%",
1942
1863
  height: 220,
@@ -1945,34 +1866,35 @@ function BarChart({
1945
1866
  tabIndex: -1,
1946
1867
  barCategoryGap: "24%",
1947
1868
  children: [
1948
- /* @__PURE__ */ jsx13(ChartXAxis, {
1869
+ /* @__PURE__ */ jsx14(ChartXAxis, {
1949
1870
  hide: true,
1950
1871
  dataKey: "id",
1951
1872
  scale: "band"
1952
1873
  }),
1953
- /* @__PURE__ */ jsx13(ChartYAxis, {
1874
+ /* @__PURE__ */ jsx14(ChartYAxis, {
1954
1875
  hide: true,
1955
1876
  domain: [0, 1],
1956
1877
  allowDataOverflow: true
1957
1878
  }),
1958
- /* @__PURE__ */ jsx13(ChartBar, {
1879
+ /* @__PURE__ */ jsx14(ChartBar, {
1959
1880
  dataKey: "plotValue",
1960
1881
  minPointSize: (value) => (value ?? 0) > 0 ? 7 : 0,
1961
- children: items.map((item) => /* @__PURE__ */ jsx13(Cell, {
1962
- fill: activeId === item.id ? "var(--atbl-accent)" : chartBarFill
1882
+ children: items.map((item) => /* @__PURE__ */ jsx14(Cell, {
1883
+ fill: chartBarFill,
1884
+ opacity: activeId === item.id ? 0.75 : 1
1963
1885
  }, item.id))
1964
1886
  })
1965
1887
  ]
1966
1888
  })
1967
1889
  }),
1968
- /* @__PURE__ */ jsx13("div", {
1890
+ /* @__PURE__ */ jsx14("div", {
1969
1891
  className: "altertable-selectable-bars-items",
1970
- children: items.map((item) => /* @__PURE__ */ jsx13(Tooltip2, {
1892
+ children: items.map((item) => /* @__PURE__ */ jsx14(Tooltip2, {
1971
1893
  variant: "chart",
1972
1894
  onOpenChange: (open) => setActiveId((current) => open ? item.id : current === item.id ? undefined : current),
1973
1895
  content: /* @__PURE__ */ jsxs9(Fragment5, {
1974
1896
  children: [
1975
- /* @__PURE__ */ jsx13("strong", {
1897
+ /* @__PURE__ */ jsx14("strong", {
1976
1898
  children: item.label
1977
1899
  }),
1978
1900
  /* @__PURE__ */ jsxs9("span", {
@@ -1993,10 +1915,10 @@ function BarChart({
1993
1915
  className: "altertable-selectable-bars-item",
1994
1916
  "aria-label": `${item.label}: ${formatValue(item.value)} ${unit}`,
1995
1917
  children: [
1996
- /* @__PURE__ */ jsx13("span", {
1918
+ /* @__PURE__ */ jsx14("span", {
1997
1919
  className: "altertable-selectable-bars-area"
1998
1920
  }),
1999
- /* @__PURE__ */ jsx13("span", {
1921
+ /* @__PURE__ */ jsx14("span", {
2000
1922
  className: "altertable-selectable-bars-label",
2001
1923
  children: item.label
2002
1924
  })
@@ -2016,7 +1938,7 @@ import {
2016
1938
  Radio as AriaRadio,
2017
1939
  Label
2018
1940
  } from "react-aria-components";
2019
- import { jsx as jsx14, jsxs as jsxs10, Fragment as Fragment6 } from "react/jsx-runtime";
1941
+ import { jsx as jsx15, jsxs as jsxs10, Fragment as Fragment6 } from "react/jsx-runtime";
2020
1942
  function RadioGroup({
2021
1943
  label,
2022
1944
  className,
@@ -2027,7 +1949,7 @@ function RadioGroup({
2027
1949
  ...props,
2028
1950
  className: classNames("altertable-radio-group", className),
2029
1951
  children: [
2030
- /* @__PURE__ */ jsx14(Label, {
1952
+ /* @__PURE__ */ jsx15(Label, {
2031
1953
  className: "altertable-control-label",
2032
1954
  children: label
2033
1955
  }),
@@ -2036,14 +1958,14 @@ function RadioGroup({
2036
1958
  });
2037
1959
  }
2038
1960
  function Radio({ className, children, ...props }) {
2039
- return /* @__PURE__ */ jsx14(AriaRadio, {
1961
+ return /* @__PURE__ */ jsx15(AriaRadio, {
2040
1962
  ...props,
2041
1963
  "data-atbl-control": "action",
2042
1964
  "data-atbl-focus": "ring",
2043
1965
  className: classNames("altertable-radio", className),
2044
1966
  children: (state) => /* @__PURE__ */ jsxs10(Fragment6, {
2045
1967
  children: [
2046
- /* @__PURE__ */ jsx14("span", {
1968
+ /* @__PURE__ */ jsx15("span", {
2047
1969
  className: "altertable-radio-mark",
2048
1970
  "aria-hidden": "true"
2049
1971
  }),
@@ -2058,13 +1980,13 @@ function SegmentedControl({
2058
1980
  ...props
2059
1981
  }) {
2060
1982
  validateChoiceOptions(options);
2061
- return /* @__PURE__ */ jsx14(RadioGroup, {
1983
+ return /* @__PURE__ */ jsx15(RadioGroup, {
2062
1984
  ...props,
2063
1985
  orientation: "horizontal",
2064
1986
  className: classNames("altertable-segmented-control", className),
2065
- children: /* @__PURE__ */ jsx14("div", {
1987
+ children: /* @__PURE__ */ jsx15("div", {
2066
1988
  className: "altertable-segmented-options",
2067
- children: options.map((option) => /* @__PURE__ */ jsx14(Radio, {
1989
+ children: options.map((option) => /* @__PURE__ */ jsx15(Radio, {
2068
1990
  value: option.id,
2069
1991
  "data-atbl-internal-surface": "option",
2070
1992
  children: option.label
@@ -2073,7 +1995,7 @@ function SegmentedControl({
2073
1995
  });
2074
1996
  }
2075
1997
  // src/react/ui/CheckboxGroup.tsx
2076
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1998
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2077
1999
  function CheckboxGroup({
2078
2000
  label,
2079
2001
  values,
@@ -2089,10 +2011,10 @@ function CheckboxGroup({
2089
2011
  disabled,
2090
2012
  className: classNames("altertable-checkbox-group", className),
2091
2013
  children: [
2092
- /* @__PURE__ */ jsx15("legend", {
2014
+ /* @__PURE__ */ jsx16("legend", {
2093
2015
  children: label
2094
2016
  }),
2095
- /* @__PURE__ */ jsx15(CheckboxGroupContext, {
2017
+ /* @__PURE__ */ jsx16(CheckboxGroupContext, {
2096
2018
  value: {
2097
2019
  values,
2098
2020
  disabled,
@@ -2106,11 +2028,16 @@ function CheckboxGroup({
2106
2028
  });
2107
2029
  }
2108
2030
  // src/react/ui/ComposedChart.tsx
2109
- import { useState as useState5 } from "react";
2031
+ import {
2032
+ useState as useState6,
2033
+ useCallback as useCallback2,
2034
+ useRef as useRef4,
2035
+ useLayoutEffect as useLayoutEffect4
2036
+ } from "react";
2110
2037
 
2111
2038
  // src/react/ui/ComposedChartLegend.tsx
2112
2039
  import { Legend } from "recharts";
2113
- import { jsx as jsx16, jsxs as jsxs12, Fragment as Fragment7 } from "react/jsx-runtime";
2040
+ import { jsx as jsx17, jsxs as jsxs12, Fragment as Fragment7 } from "react/jsx-runtime";
2114
2041
  var legendMarkerKinds = {
2115
2042
  square: "area",
2116
2043
  rect: "bar",
@@ -2137,7 +2064,7 @@ function LegendContent({
2137
2064
  if (!payload.some((entry) => entry.type !== "none"))
2138
2065
  return null;
2139
2066
  const vertical = layout === "vertical" || layout === "auto" && (position === "left" || position === "right");
2140
- return /* @__PURE__ */ jsx16(ChartLegend, {
2067
+ return /* @__PURE__ */ jsx17(ChartLegend, {
2141
2068
  "aria-label": ariaLabel,
2142
2069
  className: position === "top" || position == null && verticalAlign === "top" ? "altertable-composed-chart-legend-above" : position === "bottom" || position == null && verticalAlign !== "middle" && !vertical ? "altertable-composed-chart-legend-below" : undefined,
2143
2070
  maxVisibleItems,
@@ -2152,7 +2079,7 @@ function LegendContent({
2152
2079
  const label = formatLabel ? formatLabel(entry.value, entry, index) : entry.value;
2153
2080
  const content = /* @__PURE__ */ jsxs12(Fragment7, {
2154
2081
  children: [
2155
- type !== "none" && (entry.legendIcon ?? /* @__PURE__ */ jsx16(ChartLegend.Marker, {
2082
+ type !== "none" && (entry.legendIcon ?? /* @__PURE__ */ jsx17(ChartLegend.Marker, {
2156
2083
  kind,
2157
2084
  color: entry.inactive ? inactiveColor : entry.color,
2158
2085
  style: {
@@ -2160,17 +2087,17 @@ function LegendContent({
2160
2087
  height: kind === "square" ? iconSize : iconSize * 0.6
2161
2088
  }
2162
2089
  })),
2163
- /* @__PURE__ */ jsx16(ChartLegend.Label, {
2090
+ /* @__PURE__ */ jsx17(ChartLegend.Label, {
2164
2091
  style: labelStyle,
2165
2092
  children: label
2166
2093
  })
2167
2094
  ]
2168
2095
  });
2169
- return /* @__PURE__ */ jsx16(ChartLegend.Item, {
2096
+ return /* @__PURE__ */ jsx17(ChartLegend.Item, {
2170
2097
  inactive: entry.inactive,
2171
2098
  onMouseEnter: onMouseEnter ? (event) => onMouseEnter(entry, index, event) : undefined,
2172
2099
  onMouseLeave: onMouseLeave ? (event) => onMouseLeave(entry, index, event) : undefined,
2173
- children: onClick ? /* @__PURE__ */ jsx16("button", {
2100
+ children: onClick ? /* @__PURE__ */ jsx17("button", {
2174
2101
  type: "button",
2175
2102
  "data-atbl-control": "action",
2176
2103
  "data-atbl-focus": "ring",
@@ -2186,10 +2113,10 @@ function ComposedChartLegend({
2186
2113
  maxVisibleItems,
2187
2114
  ...props
2188
2115
  }) {
2189
- return /* @__PURE__ */ jsx16(Legend, {
2116
+ return /* @__PURE__ */ jsx17(Legend, {
2190
2117
  iconSize: 8,
2191
2118
  inactiveColor: "var(--atbl-muted)",
2192
- content: /* @__PURE__ */ jsx16(LegendContent, {
2119
+ content: /* @__PURE__ */ jsx17(LegendContent, {
2193
2120
  maxVisibleItems
2194
2121
  }),
2195
2122
  ...props
@@ -2209,7 +2136,21 @@ import {
2209
2136
  LabelList,
2210
2137
  ErrorBar
2211
2138
  } from "recharts";
2212
- import { jsx as jsx17 } from "react/jsx-runtime";
2139
+ import { jsx as jsx18 } from "react/jsx-runtime";
2140
+ function closestSeries(hovered, points, position) {
2141
+ let selected = hovered;
2142
+ if (position && points.size > 0 && (hovered == null || points.has(hovered))) {
2143
+ let distance = Infinity;
2144
+ for (const [id, point] of points) {
2145
+ const candidate = Math.hypot(point.x - position.x, point.y - position.y);
2146
+ if (candidate < distance) {
2147
+ distance = candidate;
2148
+ selected = id;
2149
+ }
2150
+ }
2151
+ }
2152
+ return selected;
2153
+ }
2213
2154
  function ComposedChartRoot({
2214
2155
  data,
2215
2156
  ariaLabel,
@@ -2219,25 +2160,96 @@ function ComposedChartRoot({
2219
2160
  className,
2220
2161
  ...props
2221
2162
  }) {
2222
- const [pointerFocus, setPointerFocus] = useState5(false);
2223
- return /* @__PURE__ */ jsx17("section", {
2224
- className: ["altertable-composed-chart", className].filter(Boolean).join(" "),
2225
- "aria-label": ariaLabel,
2226
- "data-atbl-internal-pointer-focus": pointerFocus || undefined,
2227
- onPointerDownCapture: () => setPointerFocus(true),
2228
- onKeyDownCapture: () => setPointerFocus(false),
2229
- onBlurCapture: (event) => {
2230
- if (!event.currentTarget.contains(event.relatedTarget))
2231
- setPointerFocus(false);
2163
+ const [pointerFocus, setPointerFocus] = useState6(false);
2164
+ const [pointer, setPointer] = useState6(false);
2165
+ const [hovered, setHovered] = useState6(null);
2166
+ const pointerPosition = useRef4(null);
2167
+ const [nearest, setNearest] = useState6(null);
2168
+ const [points, setPoints] = useState6(() => new Map);
2169
+ const registerPoint = useCallback2((id, x, y) => {
2170
+ setPoints((current) => new Map(current).set(id, { x, y }));
2171
+ return () => setPoints((current) => {
2172
+ const next = new Map(current);
2173
+ next.delete(id);
2174
+ return next;
2175
+ });
2176
+ }, []);
2177
+ function trackPointer(event) {
2178
+ setPointer(true);
2179
+ const svg = event.currentTarget.querySelector('svg[role="application"]');
2180
+ if (!(svg instanceof SVGSVGElement))
2181
+ return;
2182
+ const matrix = svg.getScreenCTM();
2183
+ if (!matrix)
2184
+ return;
2185
+ const point = new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse());
2186
+ pointerPosition.current = { x: point.x, y: point.y };
2187
+ setNearest(closestSeries(hovered, points, pointerPosition.current));
2188
+ }
2189
+ useLayoutEffect4(() => {
2190
+ setNearest(closestSeries(hovered, points, pointerPosition.current));
2191
+ }, [hovered, points]);
2192
+ const [seriesIds, setSeriesIds] = useState6(() => new Set);
2193
+ const registerSeries = useCallback2((id) => {
2194
+ setSeriesIds((current) => new Set(current).add(id));
2195
+ return () => {
2196
+ setSeriesIds((current) => {
2197
+ const next = new Set(current);
2198
+ next.delete(id);
2199
+ return next;
2200
+ });
2201
+ };
2202
+ }, []);
2203
+ return /* @__PURE__ */ jsx18(ChartInteraction.Provider, {
2204
+ value: {
2205
+ pointer,
2206
+ hovered: nearest,
2207
+ point: nearest == null ? undefined : points.get(nearest),
2208
+ registerPoint,
2209
+ setHovered,
2210
+ seriesCount: seriesIds.size,
2211
+ registerSeries
2232
2212
  },
2233
- children: /* @__PURE__ */ jsx17(RechartsComposedChart, {
2234
- "data-atbl-focus": "inset",
2235
- ...props,
2236
- data,
2237
- width,
2238
- height,
2239
- responsive,
2240
- title: ariaLabel
2213
+ children: /* @__PURE__ */ jsx18("section", {
2214
+ className: ["altertable-composed-chart", className].filter(Boolean).join(" "),
2215
+ "aria-label": ariaLabel,
2216
+ "data-atbl-internal-pointer-focus": pointerFocus || undefined,
2217
+ onPointerDownCapture: (event) => {
2218
+ setPointerFocus(true);
2219
+ trackPointer(event);
2220
+ },
2221
+ onPointerOverCapture: trackPointer,
2222
+ onPointerMoveCapture: trackPointer,
2223
+ onPointerLeave: (event) => {
2224
+ if (event.pointerType !== "touch") {
2225
+ setHovered(null);
2226
+ pointerPosition.current = null;
2227
+ setNearest(null);
2228
+ }
2229
+ },
2230
+ onKeyDownCapture: () => {
2231
+ setPointerFocus(false);
2232
+ setPointer(false);
2233
+ pointerPosition.current = null;
2234
+ setNearest(null);
2235
+ setHovered(null);
2236
+ },
2237
+ onBlurCapture: (event) => {
2238
+ if (!event.currentTarget.contains(event.relatedTarget))
2239
+ setPointerFocus(false);
2240
+ },
2241
+ children: /* @__PURE__ */ jsx18(ChartDateAxes, {
2242
+ data,
2243
+ children: /* @__PURE__ */ jsx18(RechartsComposedChart, {
2244
+ "data-atbl-focus": "inset",
2245
+ ...props,
2246
+ data,
2247
+ width,
2248
+ height,
2249
+ responsive,
2250
+ "aria-label": ariaLabel
2251
+ })
2252
+ })
2241
2253
  })
2242
2254
  });
2243
2255
  }
@@ -2263,17 +2275,17 @@ var ComposedChart = Object.assign(ComposedChartRoot, {
2263
2275
  ErrorBar
2264
2276
  });
2265
2277
  // src/react/ui/FunnelChart.tsx
2266
- import { Fragment as Fragment8, useEffect, useRef as useRef3, useState as useState6 } from "react";
2278
+ import { Fragment as Fragment8, useEffect as useEffect4, useRef as useRef5, useState as useState7 } from "react";
2267
2279
 
2268
2280
  // src/react/ui/useSvgId.ts
2269
- import { useId as useId2 } from "react";
2281
+ import { useId as useId3 } from "react";
2270
2282
  function useSvgId() {
2271
- const id = useId2();
2283
+ const id = useId3();
2272
2284
  return `svg-${Array.from(id, (character) => /[a-zA-Z0-9-]/.test(character) ? character : `_${character.codePointAt(0).toString(16)}_`).join("")}`;
2273
2285
  }
2274
2286
 
2275
2287
  // src/react/ui/FunnelChart.tsx
2276
- import { jsx as jsx18, jsxs as jsxs13, Fragment as Fragment9 } from "react/jsx-runtime";
2288
+ import { jsx as jsx19, jsxs as jsxs13, Fragment as Fragment9 } from "react/jsx-runtime";
2277
2289
  function FunnelChart({
2278
2290
  steps,
2279
2291
  series,
@@ -2283,14 +2295,14 @@ function FunnelChart({
2283
2295
  formatValue = formatNumber2
2284
2296
  }) {
2285
2297
  const chartId = useSvgId();
2286
- const [highlighted, setHighlighted] = useState6(null);
2287
- const clearTimer = useRef3(null);
2298
+ const [highlighted, setHighlighted] = useState7(null);
2299
+ const clearTimer = useRef5(null);
2288
2300
  function cancelClear() {
2289
2301
  if (clearTimer.current !== null)
2290
2302
  clearTimeout(clearTimer.current);
2291
2303
  clearTimer.current = null;
2292
2304
  }
2293
- useEffect(() => cancelClear, []);
2305
+ useEffect4(() => cancelClear, []);
2294
2306
  function highlight(id, conversion, step) {
2295
2307
  cancelClear();
2296
2308
  setHighlighted({ id, conversion, step });
@@ -2346,44 +2358,55 @@ function FunnelChart({
2346
2358
  ];
2347
2359
  }))
2348
2360
  }));
2349
- return /* @__PURE__ */ jsx18("section", {
2361
+ return /* @__PURE__ */ jsx19("section", {
2350
2362
  className: classNames("altertable-funnel-chart", className),
2351
2363
  "aria-label": ariaLabel,
2352
2364
  onKeyDownCapture: clearHighlight,
2353
- children: steps.length === 0 || series.length === 0 ? /* @__PURE__ */ jsx18("span", {
2365
+ children: steps.length === 0 || series.length === 0 ? /* @__PURE__ */ jsx19("span", {
2354
2366
  children: "No data"
2355
2367
  }) : /* @__PURE__ */ jsxs13(Fragment9, {
2356
2368
  children: [
2357
- /* @__PURE__ */ jsx18("div", {
2358
- className: "altertable-funnel-summary",
2359
- children: series.map((item, index) => /* @__PURE__ */ jsxs13("div", {
2360
- children: [
2361
- /* @__PURE__ */ jsxs13("span", {
2369
+ /* @__PURE__ */ jsxs13("div", {
2370
+ className: "altertable-funnel-header",
2371
+ children: [
2372
+ /* @__PURE__ */ jsx19(ChartLegend, {
2373
+ "aria-label": "Funnel series",
2374
+ layout: "single-row",
2375
+ children: series.map((item, index) => /* @__PURE__ */ jsxs13(ChartLegend.Item, {
2376
+ className: "altertable-funnel-summary-item",
2362
2377
  children: [
2363
- /* @__PURE__ */ jsx18(ChartLegend.Marker, {
2364
- kind: "square",
2365
- color: `var(--atbl-chart-${index % 8 + 1})`
2378
+ /* @__PURE__ */ jsxs13("span", {
2379
+ className: "altertable-funnel-series-label",
2380
+ children: [
2381
+ /* @__PURE__ */ jsx19(ChartLegend.Marker, {
2382
+ kind: "square",
2383
+ color: `var(--atbl-chart-${index % 8 + 1})`
2384
+ }),
2385
+ /* @__PURE__ */ jsx19(ChartLegend.Label, {
2386
+ children: item.label
2387
+ })
2388
+ ]
2366
2389
  }),
2367
- item.label
2390
+ /* @__PURE__ */ jsx19("strong", {
2391
+ className: "altertable-funnel-series-value",
2392
+ children: formatPercent2(reading(item, steps.length - 1).conversion)
2393
+ })
2368
2394
  ]
2369
- }),
2370
- /* @__PURE__ */ jsx18("strong", {
2371
- children: formatPercent2(reading(item, steps.length - 1).conversion)
2372
- })
2373
- ]
2374
- }, item.id))
2375
- }),
2376
- /* @__PURE__ */ jsxs13("p", {
2377
- className: "altertable-analytics-note",
2378
- children: [
2379
- steps[0].label,
2380
- " → ",
2381
- steps.at(-1).label
2395
+ }, item.id))
2396
+ }),
2397
+ /* @__PURE__ */ jsxs13("p", {
2398
+ className: "altertable-funnel-path",
2399
+ children: [
2400
+ steps[0].label,
2401
+ " → ",
2402
+ steps.at(-1).label
2403
+ ]
2404
+ })
2382
2405
  ]
2383
2406
  }),
2384
- /* @__PURE__ */ jsx18("div", {
2407
+ /* @__PURE__ */ jsx19("div", {
2385
2408
  className: "altertable-funnel-scroll",
2386
- children: /* @__PURE__ */ jsx18("div", {
2409
+ children: /* @__PURE__ */ jsx19("div", {
2387
2410
  style: {
2388
2411
  minWidth: steps.length * Math.max(96, series.length * 40)
2389
2412
  },
@@ -2395,73 +2418,50 @@ function FunnelChart({
2395
2418
  barGap: 1,
2396
2419
  onMouseLeave: clearHighlight,
2397
2420
  children: [
2398
- /* @__PURE__ */ jsx18(ComposedChart.CartesianGrid, {}),
2399
- /* @__PURE__ */ jsx18(ComposedChart.XAxis, {
2421
+ /* @__PURE__ */ jsx19(ComposedChart.CartesianGrid, {}),
2422
+ /* @__PURE__ */ jsx19(ComposedChart.XAxis, {
2400
2423
  dataKey: "label",
2401
2424
  interval: 0,
2402
2425
  height: 48
2403
2426
  }),
2404
- /* @__PURE__ */ jsx18(ComposedChart.YAxis, {
2427
+ /* @__PURE__ */ jsx19(ComposedChart.YAxis, {
2405
2428
  domain: [0, 100],
2406
2429
  width: 42,
2407
- tickFormatter: (value) => `${value}%`
2430
+ tickFormatter: (value) => formatPercent2(value / 100)
2408
2431
  }),
2409
- /* @__PURE__ */ jsx18("defs", {
2410
- children: series.map((item, index) => /* @__PURE__ */ jsxs13(Fragment8, {
2432
+ /* @__PURE__ */ jsx19("defs", {
2433
+ children: series.map((item, index) => /* @__PURE__ */ jsxs13("pattern", {
2434
+ id: `${chartId}-hatch-${index}`,
2435
+ patternUnits: "userSpaceOnUse",
2436
+ width: "6",
2437
+ height: "6",
2438
+ patternTransform: "rotate(45)",
2411
2439
  children: [
2412
- /* @__PURE__ */ jsxs13("linearGradient", {
2413
- id: `${chartId}-gradient-${index}`,
2440
+ /* @__PURE__ */ jsx19("rect", {
2441
+ width: "8",
2442
+ height: "8",
2443
+ fill: `var(--atbl-chart-${index % 8 + 1})`,
2444
+ fillOpacity: 0.16
2445
+ }),
2446
+ /* @__PURE__ */ jsx19("line", {
2414
2447
  x1: "0",
2448
+ y1: "0",
2415
2449
  x2: "0",
2416
- y1: "1",
2417
- y2: "0",
2418
- children: [
2419
- /* @__PURE__ */ jsx18("stop", {
2420
- offset: "0%",
2421
- stopColor: `var(--atbl-chart-${index % 8 + 1})`,
2422
- stopOpacity: 0.5
2423
- }),
2424
- /* @__PURE__ */ jsx18("stop", {
2425
- offset: "100%",
2426
- stopColor: `var(--atbl-chart-${index % 8 + 1})`,
2427
- stopOpacity: 0.7
2428
- })
2429
- ]
2430
- }),
2431
- /* @__PURE__ */ jsxs13("pattern", {
2432
- id: `${chartId}-hatch-${index}`,
2433
- patternUnits: "userSpaceOnUse",
2434
- width: "6",
2435
- height: "6",
2436
- patternTransform: "rotate(45)",
2437
- children: [
2438
- /* @__PURE__ */ jsx18("rect", {
2439
- width: "8",
2440
- height: "8",
2441
- fill: `var(--atbl-chart-${index % 8 + 1})`,
2442
- fillOpacity: 0.16
2443
- }),
2444
- /* @__PURE__ */ jsx18("line", {
2445
- x1: "0",
2446
- y1: "0",
2447
- x2: "0",
2448
- y2: "8",
2449
- stroke: `var(--atbl-chart-${index % 8 + 1})`,
2450
- strokeOpacity: 0.4,
2451
- strokeWidth: "2"
2452
- })
2453
- ]
2450
+ y2: "8",
2451
+ stroke: `var(--atbl-chart-${index % 8 + 1})`,
2452
+ strokeOpacity: 0.4,
2453
+ strokeWidth: "2"
2454
2454
  })
2455
2455
  ]
2456
2456
  }, item.id))
2457
2457
  }),
2458
2458
  series.map((item, index) => /* @__PURE__ */ jsxs13(Fragment8, {
2459
2459
  children: [
2460
- /* @__PURE__ */ jsx18(ComposedChart.Bar, {
2460
+ /* @__PURE__ */ jsx19(ComposedChart.Bar, {
2461
2461
  dataKey: `conversion${index}`,
2462
2462
  name: item.label,
2463
2463
  stackId: item.id,
2464
- fill: `url(#${chartId}-gradient-${index})`,
2464
+ fill: `var(--atbl-chart-${index % 8 + 1})`,
2465
2465
  radius: 0,
2466
2466
  maxBarSize: undefined,
2467
2467
  activeBar: false,
@@ -2471,7 +2471,7 @@ function FunnelChart({
2471
2471
  onMouseLeave: scheduleClear,
2472
2472
  onClick: (bar) => highlight(item.id, true, bar.payload.index)
2473
2473
  }),
2474
- /* @__PURE__ */ jsx18(ComposedChart.Bar, {
2474
+ /* @__PURE__ */ jsx19(ComposedChart.Bar, {
2475
2475
  dataKey: `drop${index}`,
2476
2476
  name: `${item.label} drop-off`,
2477
2477
  stackId: item.id,
@@ -2486,7 +2486,7 @@ function FunnelChart({
2486
2486
  })
2487
2487
  ]
2488
2488
  }, item.id)),
2489
- /* @__PURE__ */ jsx18(ComposedChart.Tooltip, {
2489
+ /* @__PURE__ */ jsx19(ComposedChart.Tooltip, {
2490
2490
  content: ({ active, payload }) => {
2491
2491
  const index = payload?.[0]?.payload.index;
2492
2492
  if (!active || typeof index !== "number")
@@ -2522,7 +2522,7 @@ function FunnelChart({
2522
2522
  })
2523
2523
  }));
2524
2524
  });
2525
- return /* @__PURE__ */ jsx18(ChartTooltipContent, {
2525
+ return /* @__PURE__ */ jsx19(ChartTooltipContent, {
2526
2526
  active: true,
2527
2527
  label: steps[index].label,
2528
2528
  payload: tooltipItems
@@ -2533,7 +2533,7 @@ function FunnelChart({
2533
2533
  })
2534
2534
  })
2535
2535
  }),
2536
- /* @__PURE__ */ jsx18("ul", {
2536
+ /* @__PURE__ */ jsx19("ul", {
2537
2537
  className: "altertable-sr-only",
2538
2538
  children: steps.map((step, index) => /* @__PURE__ */ jsxs13("li", {
2539
2539
  children: [
@@ -2568,7 +2568,7 @@ function FunnelChart({
2568
2568
  }
2569
2569
  // src/react/ui/RetentionChart.tsx
2570
2570
  import { Fragment as Fragment10 } from "react";
2571
- import { jsx as jsx19, jsxs as jsxs14, Fragment as Fragment11 } from "react/jsx-runtime";
2571
+ import { jsx as jsx20, jsxs as jsxs14, Fragment as Fragment11 } from "react/jsx-runtime";
2572
2572
  function RetentionChart({
2573
2573
  series,
2574
2574
  unit,
@@ -2615,10 +2615,10 @@ function RetentionChart({
2615
2615
  }
2616
2616
  });
2617
2617
  });
2618
- return /* @__PURE__ */ jsx19("section", {
2618
+ return /* @__PURE__ */ jsx20("section", {
2619
2619
  className: classNames("altertable-retention-chart", className),
2620
2620
  "aria-label": ariaLabel,
2621
- children: data.length === 0 ? /* @__PURE__ */ jsx19("span", {
2621
+ children: data.length === 0 ? /* @__PURE__ */ jsx20("span", {
2622
2622
  children: "No data"
2623
2623
  }) : /* @__PURE__ */ jsxs14(Fragment11, {
2624
2624
  children: [
@@ -2626,27 +2626,27 @@ function RetentionChart({
2626
2626
  data,
2627
2627
  ariaLabel: `${ariaLabel} plot`,
2628
2628
  children: [
2629
- /* @__PURE__ */ jsx19(ComposedChart.CartesianGrid, {}),
2630
- /* @__PURE__ */ jsx19(ComposedChart.XAxis, {
2629
+ /* @__PURE__ */ jsx20(ComposedChart.CartesianGrid, {}),
2630
+ /* @__PURE__ */ jsx20(ComposedChart.XAxis, {
2631
2631
  dataKey: "offset",
2632
2632
  type: "number",
2633
2633
  domain: [0, Math.max(1, ...offsets.keys())],
2634
2634
  tickFormatter: (value) => offsets.get(Number(value)) ?? (data[0]?.label.replace(/\d+(?:\.\d+)?/, String(value)) || String(value))
2635
2635
  }),
2636
- /* @__PURE__ */ jsx19(ComposedChart.YAxis, {
2636
+ /* @__PURE__ */ jsx20(ComposedChart.YAxis, {
2637
2637
  domain: [0, 100],
2638
2638
  width: 42,
2639
2639
  tickFormatter: (value) => `${value}%`
2640
2640
  }),
2641
2641
  series.map((item, index) => /* @__PURE__ */ jsxs14(Fragment10, {
2642
2642
  children: [
2643
- /* @__PURE__ */ jsx19(ComposedChart.Line, {
2643
+ /* @__PURE__ */ jsx20(ComposedChart.Line, {
2644
2644
  dataKey: `rate${index}`,
2645
2645
  name: item.label,
2646
2646
  stroke: `var(--atbl-chart-${index % 8 + 1})`,
2647
2647
  connectNulls: false
2648
2648
  }),
2649
- /* @__PURE__ */ jsx19(ComposedChart.Line, {
2649
+ /* @__PURE__ */ jsx20(ComposedChart.Line, {
2650
2650
  dataKey: `tail${index}`,
2651
2651
  name: item.label,
2652
2652
  stroke: `var(--atbl-chart-${index % 8 + 1})`,
@@ -2657,7 +2657,7 @@ function RetentionChart({
2657
2657
  })
2658
2658
  ]
2659
2659
  }, item.id)),
2660
- /* @__PURE__ */ jsx19(ComposedChart.Tooltip, {
2660
+ /* @__PURE__ */ jsx20(ComposedChart.Tooltip, {
2661
2661
  filterNull: false,
2662
2662
  content: ({ active, payload }) => {
2663
2663
  const offset = payload?.[0]?.payload.offset;
@@ -2667,7 +2667,7 @@ function RetentionChart({
2667
2667
  "data-variant": "chart",
2668
2668
  role: "tooltip",
2669
2669
  children: [
2670
- /* @__PURE__ */ jsx19("strong", {
2670
+ /* @__PURE__ */ jsx20("strong", {
2671
2671
  children: offsets.get(offset)
2672
2672
  }),
2673
2673
  series.map((item) => {
@@ -2689,21 +2689,21 @@ function RetentionChart({
2689
2689
  })
2690
2690
  ]
2691
2691
  }),
2692
- /* @__PURE__ */ jsx19(ChartLegend, {
2692
+ /* @__PURE__ */ jsx20(ChartLegend, {
2693
2693
  "aria-label": `${ariaLabel} cohorts`,
2694
2694
  children: series.map((item, index) => /* @__PURE__ */ jsxs14(ChartLegend.Item, {
2695
2695
  children: [
2696
- /* @__PURE__ */ jsx19(ChartLegend.Marker, {
2696
+ /* @__PURE__ */ jsx20(ChartLegend.Marker, {
2697
2697
  kind: "square",
2698
2698
  color: `var(--atbl-chart-${index % 8 + 1})`
2699
2699
  }),
2700
- /* @__PURE__ */ jsx19(ChartLegend.Label, {
2700
+ /* @__PURE__ */ jsx20(ChartLegend.Label, {
2701
2701
  children: item.label
2702
2702
  })
2703
2703
  ]
2704
2704
  }, item.id))
2705
2705
  }),
2706
- /* @__PURE__ */ jsx19("ul", {
2706
+ /* @__PURE__ */ jsx20("ul", {
2707
2707
  className: "altertable-sr-only",
2708
2708
  children: series.map((item) => /* @__PURE__ */ jsxs14("li", {
2709
2709
  children: [
@@ -2726,7 +2726,7 @@ function RetentionChart({
2726
2726
  });
2727
2727
  }
2728
2728
  // src/react/ui/JourneyChart.tsx
2729
- import { useLayoutEffect as useLayoutEffect3, useRef as useRef4, useState as useState7 } from "react";
2729
+ import { useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState8 } from "react";
2730
2730
 
2731
2731
  // src/react/ui/journey-flow.ts
2732
2732
  var journeyOutcomeLabels = {
@@ -2851,7 +2851,7 @@ function limitJourneyFlow(graph, visibleEventsByDepth = {}) {
2851
2851
  }
2852
2852
 
2853
2853
  // src/react/ui/JourneyChart.tsx
2854
- import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
2854
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2855
2855
  function JourneyChart({
2856
2856
  paths,
2857
2857
  unit,
@@ -2869,12 +2869,12 @@ function JourneyChart({
2869
2869
  invariant(path.steps.length > 0 && path.steps.every((step) => step.event.trim().length > 0), "journey chart paths require nonblank events.");
2870
2870
  }
2871
2871
  invariant(Number.isFinite(total), "journey chart total count must be finite.");
2872
- return /* @__PURE__ */ jsx20("section", {
2872
+ return /* @__PURE__ */ jsx21("section", {
2873
2873
  className: classNames("altertable-journey-chart", className),
2874
2874
  "aria-label": ariaLabel,
2875
- children: paths.length === 0 ? /* @__PURE__ */ jsx20("span", {
2875
+ children: paths.length === 0 ? /* @__PURE__ */ jsx21("span", {
2876
2876
  children: "No data"
2877
- }) : /* @__PURE__ */ jsx20(JourneyFlow, {
2877
+ }) : /* @__PURE__ */ jsx21(JourneyFlow, {
2878
2878
  paths,
2879
2879
  unit,
2880
2880
  formatValue
@@ -2886,11 +2886,11 @@ function JourneyFlow({
2886
2886
  unit,
2887
2887
  formatValue
2888
2888
  }) {
2889
- const [expandedBranch, setExpandedBranch] = useState7([]);
2890
- const [visibleEventsByDepth, setVisibleEventsByDepth] = useState7({});
2889
+ const [expandedBranch, setExpandedBranch] = useState8([]);
2890
+ const [visibleEventsByDepth, setVisibleEventsByDepth] = useState8({});
2891
2891
  const graph = limitJourneyFlow(buildJourneyFlow(paths, expandedBranch), visibleEventsByDepth);
2892
- const scrollRef = useRef4(null);
2893
- const pendingDepth = useRef4(null);
2892
+ const scrollRef = useRef6(null);
2893
+ const pendingDepth = useRef6(null);
2894
2894
  const depthCount = Math.max(0, ...graph.nodes.map((node) => node.depth)) + 1;
2895
2895
  const startingCount = graph.nodes.filter((node) => node.depth === 0).reduce((sum, node) => sum + node.count, 0);
2896
2896
  function percent(count) {
@@ -2905,7 +2905,7 @@ function JourneyFlow({
2905
2905
  function columnX(depth) {
2906
2906
  return 10 + depth * columnSpacing;
2907
2907
  }
2908
- useLayoutEffect3(() => {
2908
+ useLayoutEffect5(() => {
2909
2909
  const depth = pendingDepth.current;
2910
2910
  const container = scrollRef.current;
2911
2911
  if (depth === null || !container || depth >= depthCount)
@@ -2961,7 +2961,7 @@ function JourneyFlow({
2961
2961
  }
2962
2962
  ];
2963
2963
  });
2964
- return /* @__PURE__ */ jsx20("div", {
2964
+ return /* @__PURE__ */ jsx21("div", {
2965
2965
  ref: scrollRef,
2966
2966
  className: "altertable-journey-scroll",
2967
2967
  children: /* @__PURE__ */ jsxs15("div", {
@@ -2974,17 +2974,17 @@ function JourneyFlow({
2974
2974
  "aria-hidden": "true",
2975
2975
  focusable: "false",
2976
2976
  children: [
2977
- /* @__PURE__ */ jsx20("path", {
2977
+ /* @__PURE__ */ jsx21("path", {
2978
2978
  d: links.filter((link) => !link.muted).map((link) => link.d).join(" "),
2979
2979
  fill: "color-mix(in srgb, var(--atbl-chart-5) 22%, var(--atbl-surface))"
2980
2980
  }),
2981
- /* @__PURE__ */ jsx20("path", {
2981
+ /* @__PURE__ */ jsx21("path", {
2982
2982
  d: links.filter((link) => link.muted).map((link) => link.d).join(" "),
2983
2983
  fill: "color-mix(in srgb, var(--atbl-muted) 22%, var(--atbl-surface))"
2984
2984
  })
2985
2985
  ]
2986
2986
  }),
2987
- columns.map((column, depth) => /* @__PURE__ */ jsx20("span", {
2987
+ columns.map((column, depth) => /* @__PURE__ */ jsx21("span", {
2988
2988
  className: "altertable-journey-stage",
2989
2989
  style: { left: columnX(depth) },
2990
2990
  children: column.length > 0 && column.every((node) => node.outcome !== "event" && node.outcome !== "other") ? "Outcome" : `Step ${depth + 1}`
@@ -2998,7 +2998,7 @@ function JourneyFlow({
2998
2998
  height: startingCount > 0 ? node.count / startingCount * nodeHeight : 0
2999
2999
  },
3000
3000
  children: [
3001
- /* @__PURE__ */ jsx20("div", {
3001
+ /* @__PURE__ */ jsx21("div", {
3002
3002
  className: "altertable-journey-bar",
3003
3003
  "data-event": node.outcome === "event" || undefined,
3004
3004
  "aria-hidden": "true",
@@ -3008,7 +3008,7 @@ function JourneyFlow({
3008
3008
  "aria-label": `${node.label}, step ${node.depth + 1}, ${formatValue(node.count)} ${unit}`,
3009
3009
  className: "altertable-journey-label",
3010
3010
  children: [
3011
- /* @__PURE__ */ jsx20("span", {
3011
+ /* @__PURE__ */ jsx21("span", {
3012
3012
  className: "altertable-journey-name",
3013
3013
  title: node.label,
3014
3014
  children: node.label
@@ -3032,7 +3032,7 @@ function JourneyFlow({
3032
3032
  }) : null
3033
3033
  ]
3034
3034
  }),
3035
- node.expandable && /* @__PURE__ */ jsx20(Button2, {
3035
+ node.expandable && /* @__PURE__ */ jsx21(Button2, {
3036
3036
  variant: "outline",
3037
3037
  size: "icon-compact",
3038
3038
  className: "altertable-journey-expand",
@@ -3045,7 +3045,7 @@ function JourneyFlow({
3045
3045
  },
3046
3046
  children: node.expanded ? "−" : "›"
3047
3047
  }),
3048
- node.outcome === "other" && /* @__PURE__ */ jsx20(Button2, {
3048
+ node.outcome === "other" && /* @__PURE__ */ jsx21(Button2, {
3049
3049
  size: "compact",
3050
3050
  variant: "ghost",
3051
3051
  className: "altertable-journey-more",
@@ -3074,13 +3074,13 @@ export {
3074
3074
  ComposedChart,
3075
3075
  DataApp,
3076
3076
  DataAppProvider2 as DataAppProvider,
3077
- DataAppSkeleton,
3078
3077
  DataTable2 as DataTable,
3079
3078
  DataTableEmptyRow2 as DataTableEmptyRow,
3080
3079
  DataTableShare2 as DataTableShare,
3081
3080
  DataTableTimestamp2 as DataTableTimestamp,
3082
3081
  DataValue2 as DataValue,
3083
3082
  DataWidget2 as DataWidget,
3083
+ DateDisplay2 as DateDisplay,
3084
3084
  DateRangePicker2 as DateRangePicker,
3085
3085
  DimensionPicker2 as DimensionPicker,
3086
3086
  FilterActions2 as FilterActions,
@@ -3113,6 +3113,8 @@ export {
3113
3113
  ScatterChart,
3114
3114
  SearchField2 as SearchField,
3115
3115
  SearchMatch2 as SearchMatch,
3116
+ SearchTypeahead2 as SearchTypeahead,
3117
+ SectionHeading2 as SectionHeading,
3116
3118
  SegmentedControl,
3117
3119
  Select2 as Select,
3118
3120
  Sheet2 as Sheet,
@@ -3127,13 +3129,14 @@ export {
3127
3129
  TooltipProvider2 as TooltipProvider,
3128
3130
  VariableBar2 as VariableBar,
3129
3131
  VisualizationWidget2 as VisualizationWidget,
3130
- injectDataAppShellStyles,
3131
3132
  injectDataAppStyles2 as injectDataAppStyles,
3132
3133
  isPlainKeyEvent2 as isPlainKeyEvent,
3134
+ matchSearchText2 as matchSearchText,
3133
3135
  searchItems2 as searchItems,
3134
3136
  useAppVariables2 as useAppVariables,
3137
+ useDateFormatting2 as useDateFormatting,
3135
3138
  useSvgId,
3136
3139
  useViewTab2 as useViewTab
3137
3140
  };
3138
3141
 
3139
- //# debugId=6CFD84691873BB8C64756E2164756E21
3142
+ //# debugId=3D3A9CC87FD5C9DB64756E2164756E21