@apliteni/apliteni-ui 0.181.0 → 0.185.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.
@@ -179,6 +179,19 @@ holds each line of text that the button shows, and the menu takes the same name.
179
179
  reload. If your `palette` sets its own `onNavigate`, the shell uses that one.
180
180
  - `bandControl` stands under the sidebar head. `headControl` is one glyph control in the sidebar
181
181
  head, before the fold button.
182
+ - `bandActions` puts glyph controls, such as a notification bell, at the right end of the band,
183
+ in each sidebar structure and at every width. With a sidebar, they stand before the menu
184
+ button, and search keeps the centre of the band while it has room. Where the band is short of
185
+ room, search moves off the centre and shrinks, and never goes under an action. With no
186
+ sidebar, they stand before the theme switch. Put one or two there, and give each one a hover
187
+ title. Each action there is a 40px square with a 17px glyph, a `Button` and a dropdown trigger
188
+ alike, and the glyph stays in the centre of its square with or without a count. A count in a
189
+ dropdown trigger is a red pill on the trigger's top end corner, with a 2px ring in the band's
190
+ colour that cuts it from the glyph. The focus ring passes under it, so no ring line crosses the
191
+ digits. A long count, such as 99+, grows over the glyph and stays clear of the next control.
192
+ Give the trigger a name that holds the count it shows, such as "Notifications, 99+ unread".
193
+ Below 560px,
194
+ each action is a 40px glyph with no border and keeps a 44 by 44px tap zone.
182
195
 
183
196
  **Routing.** `renderLink` lets your router draw each section and sub-item link.
184
197
 
@@ -189,7 +202,7 @@ holds each line of text that the button shows, and the menu takes the same name.
189
202
  name and its count for keyboard and pointer users. A folded rail takes clicks only on the glyph
190
203
  column, so a click beside it reaches the page.
191
204
  - At 720px and below, the sidebar goes away and a 52px band shows. In the topbar layout, the band
192
- holds the brand mark, the page title on one line, the search trigger and a menu button. In the
205
+ holds the brand mark, the page title on one line, the search trigger, the band actions and a menu button. In the
193
206
  rail layout, it holds only the menu button and the mark. The menu button opens the full section
194
207
  list in a drawer. The drawer opens from the side of the menu button: the right in the topbar
195
208
  layout and the left in the rail layout. `drawerSide` chooses the side in either layout. The
@@ -1209,10 +1222,10 @@ chart has the title. `format` prints exact values in the readout, the live regio
1209
1222
 
1210
1223
  | `variant` | Data | `look` values | Default look |
1211
1224
  | --- | --- | --- | --- |
1212
- | `months` | `periods`, `series` | none: bars per period with a line across them | |
1225
+ | `months` | `periods`, `series` | none: columns per period with a line across them, fitted to the card | |
1213
1226
  | `bridge` | `steps` | none: one period from a start total to a result | |
1214
1227
  | `spark` | `periods`, `series` | none: one series at text size, for a stat band `trend` | |
1215
- | `line` | `periods`, `series` | `thin`; `points`, a point on each value; `labels`, the last value at the line's end, and a chart that scrolls opens on its latest period | `thin` |
1228
+ | `line` | `periods`, `series` | `thin`; `points`, a point on each value; `labels`, the last value at the line's end | `thin` |
1216
1229
  | `area` | `periods`, `series` | `flat`, each series from zero; `curves`, each series from zero as a smooth curve with a point on each value; `stacked`; `share`, each column is 100% | `stacked` |
1217
1230
  | `stacked` | `periods`, `series` | `columns`; `share`, each column is 100%; `rows`, a bar for each period | `columns` |
1218
1231
  | `donut` | `slices` | `thin`, the total in the centre; `table`, a list of the shares beside the ring; `labels`, the name, value and share at each slice | `table` |
@@ -1232,17 +1245,34 @@ values and hangs them under the line.
1232
1245
  `good`, `bad` and `neutral`. The product accent does not change them. Each full tone is at least
1233
1246
  3:1 on the card and the page in both themes.
1234
1247
 
1235
- **What the user sees.** A bar is never wider than a mark, so a wider card adds space between
1236
- columns. `legend` shows the legend. A period with `estimated` keeps its fill with a dashed edge, and
1237
- the readout and the table show its `note`. A switch at the top right shows the same numbers as a
1238
- chart or as a table. In a titled `Card`, the switch stands in the card's title row. `table={false}`
1239
- removes the switch and the table. `selectable` with `selected` and `onSelect` lets the user pick a
1240
- column, which gets a band behind it. At phone widths the plot scrolls and the value axis stays.
1248
+ **What the user sees.** In `months`, every period shares the card's width, so the plot never
1249
+ scrolls. A bar is one flat fill of its tone. It takes two thirds of its column, and at most 48px.
1250
+ Where the period labels do not fit, the chart prints every second, third or later label, counted
1251
+ from the first period that is not final, or from the latest period. Set `values` to print each
1252
+ bar's value past its end, in `formatAxis`: over a bar that grows up from zero, and under a bar
1253
+ that grows down. A value takes at most half the space to the next value,
1254
+ at the 12px text size, and stays inside the plot. A value that does not fit there is left out.
1255
+ The readout and the table always show it. A chart that prints no value gives that room to its
1256
+ bars. `legend`
1257
+ shows the legend. A period with `estimated` keeps its solid mark in the series
1258
+ ink. Set `estimated` to `'incomplete'` for the period that is still running, to `'projected'` for a
1259
+ future period, or to `true` for any other estimate. In `months`, one solid line stands before the
1260
+ first period that is not final, and the words "Not final" stand over that group. Put the periods
1261
+ that are not final last. The hover and keyboard readout and each table row say "Incomplete",
1262
+ "Projected" or "Estimated", followed by the `note`. The readout of a period also compares it with
1263
+ the period before it. Set `compare: false` on a period to show its value with no comparison text.
1264
+ A switch at the top right
1265
+ shows the same numbers as a chart or as a table. In a titled `Card`, the switch stands in the
1266
+ card's title row. `table={false}` removes the switch and the table. `selectable` with `selected`
1267
+ and `onSelect` lets the user pick a column, which gets a band behind it. In the other variants, at
1268
+ phone widths the plot scrolls and the value axis stays. A chart of periods that is wider than its
1269
+ card opens at its latest period. A bridge opens at its opening total.
1241
1270
 
1242
1271
  **Keyboard and screen reader.** The switch is the first Tab stop and the chart is the second. Left,
1243
1272
  Right, Home and End move between columns and announce each one. Enter picks a column when
1244
1273
  `selectable` is set. A plot that scrolls adds one more Tab stop for the scroll box. On a touch
1245
- screen, the first tap on a mark opens its readout and does not call `onSelect`. Every value is
1274
+ screen, the first tap on a mark opens its readout and does not call `onSelect`. After Escape, a
1275
+ new tap on the same mark opens its readout again. Every value is
1246
1276
  reachable at full strength by pointer or keyboard.
1247
1277
 
1248
1278
  ### Table values
@@ -10,7 +10,7 @@
10
10
 
11
11
  **Except:** A toast for the reader's own action, such as Saved, stays out of the bell.
12
12
 
13
- **Do:** Show “99+” above 99, and name the bell “Notifications, 120 unread”.
13
+ **Do:** Show “99+” above 99, and name it “Notifications, 99+ unread”.
14
14
 
15
15
  **Don't:** Report a failed run only in a toast.
16
16
 
@@ -24,6 +24,18 @@
24
24
 
25
25
  **Don't:** Put Payouts and its sub-items under a Money label.
26
26
 
27
+ ## Keep the bar’s end for product alerts
28
+
29
+ <!-- rule: bar-end -->
30
+
31
+ **Rule:** Put only glyph controls that serve every page, such as the notification bell, at the right end of the bar.
32
+
33
+ **Why:** The reader looks for the bell in the same place on every page, and a phone bar has room for two glyphs at most.
34
+
35
+ **Do:** Put the bell at the bar’s end, after search.
36
+
37
+ **Don't:** Put a page’s own button, such as New report, in the bar.
38
+
27
39
  ## Choose content width
28
40
 
29
41
  <!-- rule: width -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.181.0",
3
+ "version": "0.185.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
package/react/README.md CHANGED
@@ -938,8 +938,14 @@ one series at text size with no axis, for a stat band's `trend` slot.
938
938
  The numbers are yours and so is the wording. `format` prints exact values in the readout, the
939
939
  live region and the table; `formatAxis` prints the ticks, which are whole units, and defaults
940
940
  to `format`. A `bars-below` series takes positive magnitudes and is drawn under the zero line.
941
- A period marked `estimated` keeps its series fill with a dashed edge. The legend names the state.
942
- The readout and the optional table show the state and its `note`.
941
+ A period marked `estimated` keeps its solid mark in the series ink. `estimated: 'incomplete'` marks
942
+ the period that is still running, `'projected'` a future period, and `true` any other estimate.
943
+ A months chart draws one solid line before the first period that is not final, with "Not final"
944
+ over that group. The readout and the optional table say "Incomplete", "Projected" or
945
+ "Estimated", followed by the `note`. A period with `compare: false` shows its value in the
946
+ readout with no comparison. A months chart fits its card and does not scroll: it prints fewer
947
+ period labels where they do not fit, and `values` prints each bar's value where it fits. Any
948
+ other chart of periods that is wider than its card opens at its latest period.
943
949
 
944
950
  A bar series names a tone. Each tone has its own hue: `accent` is blue and `accent-soft` is
945
951
  cyan, so two series read apart by hue. `good` and `bad` say which way
@@ -1366,6 +1366,20 @@
1366
1366
  display: none;
1367
1367
  }
1368
1368
  }
1369
+ @media (min-width: 561px) {
1370
+ .ui-react-app .ui-app__bar:not(:has(> .ui-app__menu)) .ui-app__bar-gap {
1371
+ display: none;
1372
+ }
1373
+ .ui-react-app .ui-app__bar:not(:has(> .ui-app__menu)) .ui-app__search {
1374
+ margin-inline-end: auto;
1375
+ }
1376
+ }
1377
+ @media (min-width: 561px) and (max-width: 720px) {
1378
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title) > .ui-react-app__title {
1379
+ flex-shrink: 0;
1380
+ max-width: 50%;
1381
+ }
1382
+ }
1369
1383
  @media (max-width: 560px) {
1370
1384
  .ui-react-app .ui-app__bar {
1371
1385
  gap: 0;
@@ -1384,7 +1398,9 @@
1384
1398
  .ui-react-app .ui-app__bar .ui-app__menu,
1385
1399
  .ui-react-app .ui-app__bar .ui-app__search,
1386
1400
  .ui-react-app .ui-app__bar .toggle,
1387
- .ui-react-app .ui-app__bar .ui-app__user-trigger {
1401
+ .ui-react-app .ui-app__bar .ui-app__user-trigger,
1402
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-btn,
1403
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1388
1404
  flex: none;
1389
1405
  justify-content: center;
1390
1406
  width: 40px;
@@ -1399,7 +1415,9 @@
1399
1415
  }
1400
1416
  .ui-react-app .ui-app__bar .ui-app__search:hover,
1401
1417
  .ui-react-app .ui-app__bar .toggle:hover,
1402
- .ui-react-app .ui-app__bar .ui-app__user-trigger:hover {
1418
+ .ui-react-app .ui-app__bar .ui-app__user-trigger:hover,
1419
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-btn:hover,
1420
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger:hover {
1403
1421
  transform: none;
1404
1422
  background: var(--surface);
1405
1423
  }
@@ -1452,6 +1470,72 @@
1452
1470
  white-space: nowrap;
1453
1471
  }
1454
1472
  }
1473
+ .ui-react-app__band-actions {
1474
+ display: flex;
1475
+ align-items: center;
1476
+ flex: none;
1477
+ gap: var(--space-1);
1478
+ }
1479
+ .ui-react-app__band-actions > .ui-btn,
1480
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1481
+ min-width: 40px;
1482
+ min-height: 40px;
1483
+ justify-content: center;
1484
+ }
1485
+ .ui-react-app__band-actions > .ui-btn svg,
1486
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger svg {
1487
+ flex: none;
1488
+ width: 17px;
1489
+ height: 17px;
1490
+ stroke-width: 2.2;
1491
+ }
1492
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1493
+ position: relative;
1494
+ gap: 0;
1495
+ padding: 0;
1496
+ border-color: transparent;
1497
+ background: transparent;
1498
+ }
1499
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger .ui-badge {
1500
+ position: absolute;
1501
+ z-index: var(--z-base);
1502
+ inset-block-start: calc(var(--space-3) / -2);
1503
+ inset-inline-end: 0;
1504
+ min-width: var(--space-5);
1505
+ height: var(--space-5);
1506
+ padding: 0 var(--space-1);
1507
+ justify-content: center;
1508
+ border: calc(var(--space-1) / 2) solid var(--bg);
1509
+ color: var(--danger-contrast);
1510
+ background: var(--signal-solid-danger);
1511
+ }
1512
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger:hover {
1513
+ transform: none;
1514
+ background: var(--surface);
1515
+ }
1516
+ @media (min-width: 721px) {
1517
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title):has(> .ui-react-app__band-actions) {
1518
+ display: grid;
1519
+ grid-template-columns: minmax(0, 1fr) minmax(0, var(--panel-sm)) minmax(max-content, 1fr);
1520
+ }
1521
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title) > .ui-react-app__band-actions {
1522
+ grid-column: 3;
1523
+ justify-self: end;
1524
+ }
1525
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title):has(> .ui-react-app__band-actions) .ui-app__search {
1526
+ grid-column: 2;
1527
+ margin-inline: 0;
1528
+ }
1529
+ }
1530
+ @media (max-width: 560px) {
1531
+ .ui-react-app .ui-app__bar > .ui-react-app__band-actions {
1532
+ margin-inline: var(--space-1);
1533
+ --tap-clear-x: var(--space-1);
1534
+ }
1535
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger .ui-badge {
1536
+ inset-block-start: calc(var(--space-3) / -2 + 1px);
1537
+ }
1538
+ }
1455
1539
 
1456
1540
  /* src/AuthShell.css */
1457
1541
  .ui-auth__brand > span {
@@ -1014,6 +1014,9 @@ type AppShellProps = AppShellNav & {
1014
1014
  /** One glyph control in the sidebar head, before the fold button, drawn as the fold is.
1015
1015
  * On a phone it stands in the menu panel's head. Topbar layout only (#732). */
1016
1016
  headControl?: ReactNode;
1017
+ /** Glyph controls at the right end of the band, such as a notification bell, in every
1018
+ * sidebar structure and at every width. Topbar layout only (#847). */
1019
+ bandActions?: ReactNode;
1017
1020
  /** The band trigger's words and its name at every width. Below 560px the trigger shows
1018
1021
  * only its glyph (#729), and the words stay its accessible name. */
1019
1022
  searchLabel?: string;
@@ -1035,7 +1038,7 @@ type AppShellProps = AppShellNav & {
1035
1038
  /** Spread linkProps onto the router link, including children and onClick. */
1036
1039
  renderLink?: (section: AppShellLink, linkProps: ComponentPropsWithoutRef<'a'>) => ReactNode;
1037
1040
  };
1038
- declare function AppShell({ sections, groups, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
1041
+ declare function AppShell({ sections, groups, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, bandActions, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
1039
1042
 
1040
1043
  type AuthShellProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
1041
1044
  brand: ReactNode;
@@ -1207,11 +1210,18 @@ type ChartPeriod = {
1207
1210
  label: string;
1208
1211
  /** The period as the axis names it. Defaults to `label`'s first word. */
1209
1212
  short?: string;
1210
- /** The period is not final — estimated, forecast, or still running. */
1211
- estimated?: boolean;
1212
- /** Why it is not final. Printed in the readout and in the legend. */
1213
+ /**
1214
+ * The period is not final. `incomplete` is the period still running,
1215
+ * `projected` a future one, and `true` any other estimate. The readout and
1216
+ * the table name the state; the chart at rest prints none.
1217
+ */
1218
+ estimated?: ChartEstimate;
1219
+ /** Why it is not final. Printed in the readout and in the table. */
1213
1220
  note?: string;
1221
+ /** `false` prints the period's value in the readout with no comparison text. */
1222
+ compare?: boolean;
1214
1223
  };
1224
+ type ChartEstimate = boolean | 'incomplete' | 'projected';
1215
1225
  type ChartSeries = {
1216
1226
  id: string;
1217
1227
  name: string;
@@ -1239,7 +1249,7 @@ type ChartBridgeStep = {
1239
1249
  kind?: 'total' | 'change';
1240
1250
  /** A change's amount. A `total` without one takes the running total. */
1241
1251
  value?: number;
1242
- estimated?: boolean;
1252
+ estimated?: ChartEstimate;
1243
1253
  note?: string;
1244
1254
  };
1245
1255
  type ChartBridgeTones = {
@@ -1278,6 +1288,10 @@ type ChartProps = ChartCommon & ({
1278
1288
  variant?: 'months';
1279
1289
  periods: readonly ChartPeriod[];
1280
1290
  series: readonly ChartSeries[];
1291
+ /** Print each bar's value past its end, in `formatAxis`: over a bar that grows
1292
+ * up from zero, under one that grows down. A value that does not
1293
+ * fit its bar's room is left out; the readout and the table keep it. */
1294
+ values?: boolean;
1281
1295
  } | {
1282
1296
  variant: 'spark';
1283
1297
  periods: readonly ChartPeriod[];
@@ -1484,4 +1498,4 @@ declare const PAGE_SIZES: readonly number[];
1484
1498
  declare const DEFAULT_PAGE_SIZE: number;
1485
1499
 
1486
1500
  export { AccentPicker, AccountMenu, AccountWindow, AppShell, AuthShell, Avatar, BackLink, Badge, BusyRegion, Button, Callout, Card, Chart, CheckList, Checkbox, CommandPalette, Confirm, DEFAULT_PAGE_SIZE, DataTable, DatePicker, DeltaValue, Denied, Drawer, DrawerSection, Dropdown, EmptyState, Feedback, Field, FileDrop, FileField, FilterBar, Footer, Icon, KeyValueList, Modal, NavTabs, NumericValue, PAGE_SIZES, Pagination, Pill, RowIdentity, SearchField, Segmented, SelectField, SidebarNav, Skeleton, SkeletonTable, Snippet, StatBand, StatusDot, Success, SuccessCheck, SuccessPanel, Switch, THEME_INIT_SCRIPT, Tabs, TextArea, TextField, ThemeChoice, ThemeToggle, Timeline, Toast, Tooltip, TopBar, VersionSwitcher, ViewSwitch, sortTableRows, useToast };
1487
- export type { Accent, AccentPickerProps, AccountMenuProps, AccountReader, AccountSection, AccountWindowProps, AddFilter, AppShellGroup, AppShellLink, AppShellProps, AppShellSection, AuthShellProps, AvatarProps, BackLinkOwnProps, BackLinkProps, BusyRegionProps, ButtonLinkProps, ButtonProps, CalloutProps, CalloutVariant, ChartAreaLook, ChartBridgeStep, ChartBridgeTones, ChartDonutLook, ChartLineLook, ChartLookSeries, ChartPeriod, ChartProps, ChartSeries, ChartSlice, ChartStackedLook, ChartTone, CheckListProps, CheckboxProps, Column, CommandGroup, CommandItem, CommandPaletteProps, ConfirmProps, DataTableProps, DatePickerMode, DatePickerPreset, DatePickerProps, DatePickerRange, DeltaValueProps, DeniedProps, DrawerProps, DrawerSectionProps, DropdownAvatar, DropdownBadge, DropdownEntry, DropdownItem, DropdownProps, DropdownRowProps, DropdownSearch, DropdownSection, DropdownSeparator, EmptyStateProps, EmptyStateVariant, FeedbackPayload, FeedbackProps, FeedbackResult, FeedbackSection, FieldControlProps, FieldProps, FileDropFile, FileDropProps, FileDropStatus, FileFieldProps, Filter, FilterBarProps, FooterColumn, FooterLink, FooterProps, FooterSocial, KeyValueListProps, KeyValueRow, ModalProps, NativeButtonProps, NavTabBadge, NavTabItem, NavTabsProps, NumericValueProps, PaginationProps, PillProps, RowIdentityProps, SearchFieldProps, SegmentOption, SegmentedProps, SelectFieldProps, SidebarNavBadge, SidebarNavBlock, SidebarNavGroup, SidebarNavItem, SidebarNavLeaf, SidebarNavProps, SidebarNavRow, SidebarNavSection, SidebarNavSections, SkeletonProps, SkeletonTableProps, SnippetProps, StatBandProps, StatDelta, StatFigure, StatTone, StatVariant, StatusDotProps, SuccessCheckProps, SuccessCountdown, SuccessPanelProps, SuccessProps, SwitchProps, TabItem, TableSort, TabsProps, TextAreaProps, TextFieldProps, ThemeChoiceProps, ThemeToggleProps, TimelineEvent, TimelineEventKind, TimelineProps, ToastNotice, ToastProps, TooltipProps, TopBarProps, Version, VersionSwitcherProps, ViewSwitchItem, ViewSwitchProps };
1501
+ export type { Accent, AccentPickerProps, AccountMenuProps, AccountReader, AccountSection, AccountWindowProps, AddFilter, AppShellGroup, AppShellLink, AppShellProps, AppShellSection, AuthShellProps, AvatarProps, BackLinkOwnProps, BackLinkProps, BusyRegionProps, ButtonLinkProps, ButtonProps, CalloutProps, CalloutVariant, ChartAreaLook, ChartBridgeStep, ChartBridgeTones, ChartDonutLook, ChartEstimate, ChartLineLook, ChartLookSeries, ChartPeriod, ChartProps, ChartSeries, ChartSlice, ChartStackedLook, ChartTone, CheckListProps, CheckboxProps, Column, CommandGroup, CommandItem, CommandPaletteProps, ConfirmProps, DataTableProps, DatePickerMode, DatePickerPreset, DatePickerProps, DatePickerRange, DeltaValueProps, DeniedProps, DrawerProps, DrawerSectionProps, DropdownAvatar, DropdownBadge, DropdownEntry, DropdownItem, DropdownProps, DropdownRowProps, DropdownSearch, DropdownSection, DropdownSeparator, EmptyStateProps, EmptyStateVariant, FeedbackPayload, FeedbackProps, FeedbackResult, FeedbackSection, FieldControlProps, FieldProps, FileDropFile, FileDropProps, FileDropStatus, FileFieldProps, Filter, FilterBarProps, FooterColumn, FooterLink, FooterProps, FooterSocial, KeyValueListProps, KeyValueRow, ModalProps, NativeButtonProps, NavTabBadge, NavTabItem, NavTabsProps, NumericValueProps, PaginationProps, PillProps, RowIdentityProps, SearchFieldProps, SegmentOption, SegmentedProps, SelectFieldProps, SidebarNavBadge, SidebarNavBlock, SidebarNavGroup, SidebarNavItem, SidebarNavLeaf, SidebarNavProps, SidebarNavRow, SidebarNavSection, SidebarNavSections, SkeletonProps, SkeletonTableProps, SnippetProps, StatBandProps, StatDelta, StatFigure, StatTone, StatVariant, StatusDotProps, SuccessCheckProps, SuccessCountdown, SuccessPanelProps, SuccessProps, SwitchProps, TabItem, TableSort, TabsProps, TextAreaProps, TextFieldProps, ThemeChoiceProps, ThemeToggleProps, TimelineEvent, TimelineEventKind, TimelineProps, ToastNotice, ToastProps, TooltipProps, TopBarProps, Version, VersionSwitcherProps, ViewSwitchItem, ViewSwitchProps };
@@ -477,7 +477,7 @@ import { useId as useId4 } from "react";
477
477
 
478
478
  // src/tip.ts
479
479
  var TIP_GAP = 8;
480
- function placeTip(host, mark, tip, bound, placement = "top") {
480
+ function placeTip(host, mark, tip, placement = "top") {
481
481
  const mrect = mark.getBoundingClientRect();
482
482
  const view = host.ownerDocument.documentElement;
483
483
  const declared = parseFloat(getComputedStyle(tip).getPropertyValue("--ui-tip-gap"));
@@ -496,13 +496,6 @@ function placeTip(host, mark, tip, bound, placement = "top") {
496
496
  clip.right = Math.min(clip.right, left2 + el.clientWidth);
497
497
  clip.bottom = Math.min(clip.bottom, top + el.clientHeight);
498
498
  }
499
- if (bound) {
500
- const edge = bound.getBoundingClientRect();
501
- clip.top = Math.max(clip.top, edge.top);
502
- clip.left = Math.max(clip.left, edge.left);
503
- clip.right = Math.min(clip.right, edge.right);
504
- clip.bottom = Math.min(clip.bottom, edge.bottom);
505
- }
506
499
  const above = mrect.top - clip.top;
507
500
  const below = clip.bottom - mrect.bottom;
508
501
  const prefersBelow = placement === "bottom";
@@ -619,7 +612,7 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
619
612
  const target = active.current;
620
613
  if (!h || !t || !target) return;
621
614
  const anchor = target.querySelector("[data-tip-anchor]") || target;
622
- placeTip(h, anchor, t, void 0, placement);
615
+ placeTip(h, anchor, t, placement);
623
616
  }
624
617
  useLayoutEffect2(() => {
625
618
  const t = tip.current;
@@ -5079,6 +5072,7 @@ function AppShell({
5079
5072
  tools,
5080
5073
  bandControl,
5081
5074
  headControl,
5075
+ bandActions,
5082
5076
  account,
5083
5077
  accountItems = [],
5084
5078
  onSignOut,
@@ -5246,6 +5240,7 @@ function AppShell({
5246
5240
  }
5247
5241
  )
5248
5242
  ] });
5243
+ const ends = bandActions && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__band-actions", children: bandActions });
5249
5244
  const control = bandControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__control", inert: collapsed, children: bandControl });
5250
5245
  return /* @__PURE__ */ jsxs37("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
5251
5246
  navigable && /* @__PURE__ */ jsxs37("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
@@ -5269,6 +5264,7 @@ function AppShell({
5269
5264
  /* @__PURE__ */ jsx41("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
5270
5265
  ] }),
5271
5266
  /* @__PURE__ */ jsx41("span", { className: "ui-app__bar-gap" }),
5267
+ navigable && ends,
5272
5268
  navigable ? /* @__PURE__ */ jsx41(
5273
5269
  Button,
5274
5270
  {
@@ -5285,6 +5281,7 @@ function AppShell({
5285
5281
  ) : /* @__PURE__ */ jsxs37(Fragment19, { children: [
5286
5282
  bandControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: bandControl }),
5287
5283
  headControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: headControl }),
5284
+ ends,
5288
5285
  /* @__PURE__ */ jsx41(ThemeToggle, {}),
5289
5286
  /* @__PURE__ */ jsx41("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx41(
5290
5287
  Dropdown,
@@ -6105,6 +6102,17 @@ var FALLBACK_COL = 48;
6105
6102
  var BAR_SHARE = 0.5;
6106
6103
  var BAR_MAX = 12;
6107
6104
  var BAR_MAX_BRIDGE = 22;
6105
+ var FIT_SHARE = 2 / 3;
6106
+ var FIT_MAX = 48;
6107
+ var FIT_CORNER = 6;
6108
+ var TEXT_GAP = 4;
6109
+ var LABEL_GAP = 8;
6110
+ var TEXT_SIZE = 12;
6111
+ var VALUE_ROOM = Math.ceil(TEXT_SIZE * 1.45) + TEXT_GAP;
6112
+ var GROUP_ROOM = 32;
6113
+ var GROUP_BASELINE = 16;
6114
+ var BOUNDARY_TOP = 24;
6115
+ var GROUP_WORDS = "Not final";
6108
6116
  var LANE_GAP = 2;
6109
6117
  var MISSING2 = "\u2014";
6110
6118
  function fadeOf(uid, m, bridge) {
@@ -6114,19 +6122,22 @@ function fadeOf(uid, m, bridge) {
6114
6122
  }
6115
6123
  var cx9 = (...parts) => parts.filter(Boolean).join(" ");
6116
6124
  var px2 = (n) => Math.round(n * 10) / 10;
6125
+ var STATE_WORD = { incomplete: "Incomplete", projected: "Projected" };
6117
6126
  var columnOf = (p, fallback) => ({
6118
6127
  label: p.label,
6119
6128
  short: p.short || fallback,
6120
6129
  estimated: Boolean(p.estimated),
6121
- note: p.note
6130
+ note: p.note,
6131
+ compare: !("compare" in p) || p.compare !== false,
6132
+ state: !p.estimated ? void 0 : p.estimated === true ? "Estimated" : STATE_WORD[p.estimated]
6122
6133
  });
6123
6134
  function onPrevious(value, previous, when) {
6124
6135
  if (previous === void 0 || previous === 0 || !Number.isFinite(previous) || !when) return "";
6125
6136
  const pct2 = (value - previous) / Math.abs(previous) * 100;
6126
6137
  return `${pct2 < 0 ? "\u2212" : "+"}${Math.abs(pct2).toFixed(1)}% on ${when}`;
6127
6138
  }
6128
- function barPath(m) {
6129
- const r = Math.min(m.w / 2, m.h / (m.foot ? 1 : 4));
6139
+ function barPath(m, corner = m.w / 2) {
6140
+ const r = Math.min(corner, m.w / 2, m.h / (m.foot ? 1 : 4));
6130
6141
  const { x, y: top, w, h } = m;
6131
6142
  const bottom = top + h;
6132
6143
  const arc2 = (dx, dy, sweep) => `a${px2(r)} ${px2(r)} 0 0 ${sweep} ${px2(dx)} ${px2(dy)}`;
@@ -6147,9 +6158,42 @@ function useTapFloor() {
6147
6158
  }, []);
6148
6159
  return floor;
6149
6160
  }
6161
+ function useTextWidth(host) {
6162
+ const [face, setFace] = useState21(null);
6163
+ const [loaded, setLoaded] = useState21(0);
6164
+ useEffect21(() => {
6165
+ const el = host.current;
6166
+ if (!el || typeof OffscreenCanvas === "undefined") return;
6167
+ const style = getComputedStyle(el);
6168
+ const font = (weight) => `${weight} ${TEXT_SIZE}px ${style.fontFamily}`;
6169
+ setFace({ regular: font(style.fontWeight), medium: font(style.getPropertyValue("--weight-medium").trim() || "500") });
6170
+ let live = true;
6171
+ el.ownerDocument.fonts?.ready.then(() => {
6172
+ if (live) setLoaded((n) => n + 1);
6173
+ });
6174
+ return () => {
6175
+ live = false;
6176
+ };
6177
+ }, [host]);
6178
+ return useMemo6(() => {
6179
+ void loaded;
6180
+ const ctx = face ? new OffscreenCanvas(1, 1).getContext("2d") : null;
6181
+ return (text2, medium = false) => {
6182
+ if (!ctx || !face) return text2.length * TEXT_SIZE * 0.62;
6183
+ ctx.font = medium ? face.medium : face.regular;
6184
+ return Math.ceil(ctx.measureText(text2).width);
6185
+ };
6186
+ }, [face, loaded]);
6187
+ }
6188
+ function barValue(bar) {
6189
+ return bar.band === "down" ? bar.from - bar.to : bar.to - bar.from;
6190
+ }
6191
+ function printsBelow(bar) {
6192
+ return bar.to < bar.from;
6193
+ }
6150
6194
  function stateOf(column) {
6151
- if (!column?.estimated) return "";
6152
- return column.note ? `Estimated \u2014 ${column.note}` : "Estimated";
6195
+ if (!column?.state) return "";
6196
+ return column.note ? `${column.state} \u2014 ${column.note}` : column.state;
6153
6197
  }
6154
6198
  function seriesFrame(periods, series, spark, format) {
6155
6199
  const columns = periods.map((p) => columnOf(p, p.label.split(" ")[0]));
@@ -6182,7 +6226,7 @@ function seriesFrame(periods, series, spark, format) {
6182
6226
  column: i,
6183
6227
  from: 0,
6184
6228
  to: below ? -value : value,
6185
- detail: onPrevious(value, s.values[i - 1], columns[i - 1]?.short ?? ""),
6229
+ detail: columns[i].compare ? onPrevious(value, s.values[i - 1], columns[i - 1]?.short ?? "") : "",
6186
6230
  band,
6187
6231
  lane,
6188
6232
  lanes
@@ -6315,7 +6359,7 @@ function donutFrame(look, slices, totalLabel, format) {
6315
6359
  to: [total > 0 ? at / total : 0]
6316
6360
  };
6317
6361
  });
6318
- const columns = slices.map((s) => ({ label: s.name, short: s.name, estimated: false }));
6362
+ const columns = slices.map((s) => ({ label: s.name, short: s.name, estimated: false, compare: false }));
6319
6363
  return {
6320
6364
  columns,
6321
6365
  scale: { min: 0, max: 1, step: 1, ticks: [] },
@@ -6370,6 +6414,8 @@ function Chart(props) {
6370
6414
  } = props;
6371
6415
  const variant = props.variant ?? "months";
6372
6416
  const spark = variant === "spark";
6417
+ const fit = variant === "months";
6418
+ const showValues = fit && "values" in props && props.values === true;
6373
6419
  const plotHeight = height ?? HEIGHT[variant];
6374
6420
  const showTable = table ?? !spark;
6375
6421
  const [view, setView] = useState21("chart");
@@ -6390,7 +6436,9 @@ function Chart(props) {
6390
6436
  const opening = useRef25(false);
6391
6437
  const pointerFocus = useRef25(false);
6392
6438
  const floor = useTapFloor();
6439
+ const textWidth = useTextWidth(frameEl);
6393
6440
  const [width, setWidth] = useState21(0);
6441
+ const [boxWidth, setBoxWidth] = useState21(0);
6394
6442
  const [overflows, setOverflows] = useState21(false);
6395
6443
  const [openId, setOpenId] = useState21(null);
6396
6444
  const [rawCursor, setCursor] = useState21(0);
@@ -6419,20 +6467,33 @@ function Chart(props) {
6419
6467
  const boxHeight = Math.max(plotHeight, floor);
6420
6468
  const boxTop = -(boxHeight - plotHeight) / 2;
6421
6469
  const span = scale.max - scale.min || 1;
6470
+ const groupFrom = fit ? columns.findIndex((c) => c.estimated) : -1;
6471
+ const lanes = Math.max(1, ...frame.bars.map((b) => b.lanes));
6472
+ const cap = fit ? FIT_MAX : variant === "bridge" ? BAR_MAX_BRIDGE : BAR_MAX;
6473
+ const groupWidth = fit ? Math.max(lanes * 2, Math.min(colWidth * FIT_SHARE, cap * lanes + LANE_GAP * (lanes - 1))) : Math.max(4, Math.min(colWidth * BAR_SHARE, colWidth - 6, cap * lanes + LANE_GAP * (lanes - 1)));
6474
+ const barWidth = Math.max(1, (groupWidth - LANE_GAP * (lanes - 1)) / lanes);
6475
+ const centre = useCallback8((column) => column * colWidth + colWidth / 2, [colWidth]);
6476
+ const barX = useCallback8((bar) => centre(bar.column) - (bar.lanes * barWidth + LANE_GAP * (bar.lanes - 1)) / 2 + bar.lane * (barWidth + LANE_GAP), [centre, barWidth]);
6477
+ const under = useMemo6(() => new Set(frame.bars.filter(printsBelow).map((b) => b.id)), [frame.bars]);
6478
+ const printed = useMemo6(() => {
6479
+ const out = /* @__PURE__ */ new Set();
6480
+ if (!showValues) return out;
6481
+ const at = frame.bars.map((bar) => ({ bar, x: barX(bar) + barWidth / 2 }));
6482
+ for (const { bar, x } of at) {
6483
+ const side = at.filter((o) => o.bar !== bar && under.has(o.bar.id) === under.has(bar.id));
6484
+ const left = Math.min(2 * x, ...side.filter((o) => o.x <= x).map((o) => x - o.x));
6485
+ const right = Math.min(2 * (plotWidth - x), ...side.filter((o) => o.x > x).map((o) => o.x - x));
6486
+ if (textWidth(formatAxis(barValue(bar))) + TEXT_GAP <= Math.min(left, right)) out.add(bar.id);
6487
+ }
6488
+ return out;
6489
+ }, [showValues, frame.bars, under, barX, barWidth, plotWidth, textWidth, formatAxis]);
6490
+ const roomTop = (groupFrom >= 0 ? GROUP_ROOM : 0) + ([...printed].some((id) => !under.has(id)) ? VALUE_ROOM : 0);
6491
+ const roomBottom = [...printed].some((id) => under.has(id)) ? VALUE_ROOM : 0;
6422
6492
  const y = useCallback8(
6423
- (value) => PAD + (scale.max - value) / span * (plotHeight - PAD * 2),
6424
- [scale.max, span, plotHeight]
6493
+ (value) => PAD + roomTop + (scale.max - value) / span * (plotHeight - PAD * 2 - roomTop - roomBottom),
6494
+ [scale.max, span, plotHeight, roomTop, roomBottom]
6425
6495
  );
6426
6496
  const zero = y(Math.min(Math.max(0, scale.min), scale.max));
6427
- const lanes = Math.max(1, ...frame.bars.map((b) => b.lanes));
6428
- const cap = variant === "bridge" ? BAR_MAX_BRIDGE : BAR_MAX;
6429
- const groupWidth = Math.max(4, Math.min(
6430
- colWidth * BAR_SHARE,
6431
- colWidth - 6,
6432
- cap * lanes + LANE_GAP * (lanes - 1)
6433
- ));
6434
- const barWidth = (groupWidth - LANE_GAP * (lanes - 1)) / lanes;
6435
- const centre = useCallback8((column) => column * colWidth + colWidth / 2, [colWidth]);
6436
6497
  const axisFormat = look?.share ? pct : formatAxis;
6437
6498
  const geometry = useMemo6(() => look ? {
6438
6499
  look,
@@ -6472,7 +6533,7 @@ function Chart(props) {
6472
6533
  column: bar.column,
6473
6534
  name: bar.name,
6474
6535
  tone: bar.tone,
6475
- value: bar.band === "down" ? bar.from - bar.to : bar.to - bar.from,
6536
+ value: barValue(bar),
6476
6537
  detail: bar.detail,
6477
6538
  kind: "bar",
6478
6539
  band: bar.band,
@@ -6483,7 +6544,7 @@ function Chart(props) {
6483
6544
  // the lanes it actually has: a chart with two series above the line and
6484
6545
  // one below puts the single one in the middle of its column rather than
6485
6546
  // in the left half of a group it does not fill.
6486
- x: centre(bar.column) - (bar.lanes * barWidth + LANE_GAP * (bar.lanes - 1)) / 2 + bar.lane * (barWidth + LANE_GAP),
6547
+ x: barX(bar),
6487
6548
  y: top,
6488
6549
  w: barWidth,
6489
6550
  h: Math.max(bottom - top, 1),
@@ -6500,7 +6561,7 @@ function Chart(props) {
6500
6561
  name: keys.find((k) => k.id === line.id)?.name ?? line.id,
6501
6562
  tone: line.tone,
6502
6563
  value,
6503
- detail: onPrevious(value, line.values[i - 1], columns[i - 1]?.short ?? ""),
6564
+ detail: columns[i]?.compare ? onPrevious(value, line.values[i - 1], columns[i - 1]?.short ?? "") : "",
6504
6565
  kind: "dot",
6505
6566
  band: "full",
6506
6567
  foot: null,
@@ -6523,9 +6584,10 @@ function Chart(props) {
6523
6584
  );
6524
6585
  }
6525
6586
  return [...out, ...dots];
6526
- }, [geometry, frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
6587
+ }, [geometry, frame, lines, keys, columns, centre, barX, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
6527
6588
  const byId = useMemo6(() => new Map(marks.map((m) => [m.id, m])), [marks]);
6528
- const fades = useMemo6(() => new Map(marks.filter((m) => m.kind === "bar").map((m) => fadeOf(uid, m, variant === "bridge")).filter((f) => f !== null).map((f) => [f.id, f])), [marks, uid, variant]);
6589
+ const fadeFor = useCallback8((m) => fit ? null : fadeOf(uid, m, variant === "bridge"), [fit, uid, variant]);
6590
+ const fades = useMemo6(() => new Map(marks.filter((m) => m.kind === "bar").map(fadeFor).filter((f) => f !== null).map((f) => [f.id, f])), [marks, fadeFor]);
6529
6591
  const lead = useCallback8((column) => marks.find((m) => m.column === column), [marks]);
6530
6592
  const open = openId ? byId.get(openId) : void 0;
6531
6593
  useEffect21(() => {
@@ -6534,6 +6596,7 @@ function Chart(props) {
6534
6596
  if (!el || !box2) return;
6535
6597
  const read = () => {
6536
6598
  setWidth(el.clientWidth);
6599
+ setBoxWidth(box2.clientWidth);
6537
6600
  setOverflows(box2.scrollWidth > box2.clientWidth);
6538
6601
  };
6539
6602
  read();
@@ -6543,15 +6606,15 @@ function Chart(props) {
6543
6606
  observer.observe(box2);
6544
6607
  return () => observer.disconnect();
6545
6608
  }, []);
6546
- const opensAtEnd = variant === "line" && lookName === "labels";
6609
+ const opensAtEnd = Boolean(periods);
6547
6610
  useLayoutEffect5(() => {
6548
6611
  const el = scroller.current;
6549
6612
  if (opensAtEnd && el) el.scrollLeft = el.scrollWidth - el.clientWidth;
6550
- }, [opensAtEnd, plotWidth, count]);
6613
+ }, [opensAtEnd, plotWidth, boxWidth, count]);
6551
6614
  useLayoutEffect5(() => {
6552
6615
  if (!openId || !frameEl.current || !tipEl.current || !svgEl.current) return;
6553
- const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
6554
- if (anchor) placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
6616
+ const anchor2 = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
6617
+ if (anchor2) placeTip(frameEl.current, anchor2, tipEl.current);
6555
6618
  }, [openId, plotWidth, plotHeight]);
6556
6619
  useEffect21(() => {
6557
6620
  if (!openId) return;
@@ -6592,6 +6655,16 @@ function Chart(props) {
6592
6655
  const state = stateOf(where);
6593
6656
  setSaid(`${where.label}. ${values}.${state ? ` ${state}.` : ""}${picked === column ? " Selected." : ""}`);
6594
6657
  }, [columns, marks, format, pick, totalLabel]);
6658
+ const inView = (column) => {
6659
+ const el = scroller.current;
6660
+ if (!el || el.scrollWidth <= el.clientWidth || !colWidth) return column;
6661
+ const first = Math.min(count - 1, Math.max(0, Math.ceil(el.scrollLeft / colWidth - 0.01)));
6662
+ const last = Math.max(first, Math.min(
6663
+ count - 1,
6664
+ Math.floor((el.scrollLeft + el.clientWidth) / colWidth + 0.01) - 1
6665
+ ));
6666
+ return Math.min(Math.max(column, first), last);
6667
+ };
6595
6668
  const step = (next) => {
6596
6669
  const column = Math.max(0, Math.min(next, count - 1));
6597
6670
  setCursor(column);
@@ -6626,20 +6699,12 @@ function Chart(props) {
6626
6699
  announce(cursor, cursor);
6627
6700
  }
6628
6701
  };
6629
- const estimated = columns.filter((c) => c.estimated);
6630
- const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
6631
6702
  const hitBand = (band) => band === "up" ? { y: PAD, h: Math.max(zero - PAD, TARGET) } : band === "down" ? { y: zero, h: Math.max(plotHeight - PAD - zero, TARGET) } : { y: PAD, h: Math.max(plotHeight - PAD * 2, TARGET) };
6632
6703
  const legendFirst = !(look?.variant === "donut" && look.look !== "labels");
6633
- const legend = keyed && !asTable && keys.length > 0 && !(look?.variant === "donut" && look.look === "table") && /* @__PURE__ */ jsxs43("ul", { className: "ui-chart__legend", children: [
6634
- keys.map((key) => /* @__PURE__ */ jsxs43("li", { className: cx9("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
6635
- /* @__PURE__ */ jsx47(KeyMark, { shape: key.shape }),
6636
- key.name
6637
- ] }, key.id)),
6638
- estimated.length > 0 && /* @__PURE__ */ jsxs43("li", { className: cx9("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
6639
- /* @__PURE__ */ jsx47("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx47("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "2.5" }) }),
6640
- "Estimated"
6641
- ] })
6642
- ] });
6704
+ const legend = keyed && !asTable && keys.length > 0 && !(look?.variant === "donut" && look.look === "table") && /* @__PURE__ */ jsx47("ul", { className: "ui-chart__legend", children: keys.map((key) => /* @__PURE__ */ jsxs43("li", { className: cx9("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
6705
+ /* @__PURE__ */ jsx47(KeyMark, { shape: key.shape }),
6706
+ key.name
6707
+ ] }, key.id)) });
6643
6708
  const viewSwitch = showTable && /* @__PURE__ */ jsx47(
6644
6709
  Segmented,
6645
6710
  {
@@ -6654,6 +6719,15 @@ function Chart(props) {
6654
6719
  }
6655
6720
  );
6656
6721
  const noun = look?.layout === "ring" ? "slices" : look?.layout === "rows" ? "rows" : "columns";
6722
+ const labelRoom = Math.max(0, ...columns.map((c) => textWidth(c.short))) + LABEL_GAP;
6723
+ const every = labelRoom > colWidth ? Math.ceil(labelRoom / colWidth) : 1;
6724
+ const anchor = groupFrom >= 0 ? groupFrom : count - 1;
6725
+ const labelled = (i) => ((anchor - i) % every + every) % every === 0;
6726
+ const edgeOf = (i) => {
6727
+ const half = textWidth(columns[i].short) / 2;
6728
+ return centre(i) - half < 0 ? "is-start" : centre(i) + half > plotWidth ? "is-end" : null;
6729
+ };
6730
+ const groupX = groupFrom >= 0 ? Math.min(Math.max(groupFrom * colWidth, 1), plotWidth - 1) : 0;
6657
6731
  return /* @__PURE__ */ jsxs43(
6658
6732
  "div",
6659
6733
  {
@@ -6668,7 +6742,9 @@ function Chart(props) {
6668
6742
  "--ui-chart-h": `${plotHeight}px`,
6669
6743
  "--ui-chart-box": `${px2(boxHeight)}px`,
6670
6744
  "--ui-chart-cols": count,
6671
- "--ui-chart-pad": `${PAD}px`
6745
+ "--ui-chart-pad": `${PAD}px`,
6746
+ "--ui-chart-top": `${PAD + roomTop}px`,
6747
+ "--ui-chart-bottom": `${PAD + roomBottom}px`
6672
6748
  },
6673
6749
  children: [
6674
6750
  toCard && createPortal8(viewSwitch, toCard),
@@ -6692,11 +6768,14 @@ function Chart(props) {
6692
6768
  pointerFocus.current = false;
6693
6769
  return;
6694
6770
  }
6695
- show(lead(cursor)?.id);
6696
- announce(cursor);
6771
+ const column = inView(cursor);
6772
+ setCursor(column);
6773
+ show(lead(column)?.id);
6774
+ announce(column);
6697
6775
  },
6698
6776
  onBlur: (event) => {
6699
6777
  if (event.target !== event.currentTarget) return;
6778
+ if (pointerFocus.current) return;
6700
6779
  setOpenId(null);
6701
6780
  setSaid("");
6702
6781
  },
@@ -6711,12 +6790,12 @@ function Chart(props) {
6711
6790
  role: overflows ? "region" : void 0,
6712
6791
  "aria-label": overflows ? `${title}. Scroll for more ${noun}.` : void 0,
6713
6792
  onScroll: () => {
6714
- const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
6715
- if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
6716
- const mark = anchor.getBoundingClientRect();
6793
+ const anchor2 = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
6794
+ if (!anchor2 || !scroller.current || !frameEl.current || !tipEl.current) return;
6795
+ const mark = anchor2.getBoundingClientRect();
6717
6796
  const view2 = scroller.current.getBoundingClientRect();
6718
6797
  if (mark.right <= view2.left || mark.left >= view2.right) setOpenId(null);
6719
- else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
6798
+ else placeTip(frameEl.current, anchor2, tipEl.current);
6720
6799
  },
6721
6800
  children: /* @__PURE__ */ jsxs43("div", { ref: plot, className: "ui-chart__plot", children: [
6722
6801
  /* @__PURE__ */ jsxs43(
@@ -6757,7 +6836,8 @@ function Chart(props) {
6757
6836
  opening.current = false;
6758
6837
  setOpenId(null);
6759
6838
  } else {
6760
- opening.current = Boolean(id) && dismissed.current !== id;
6839
+ dismissed.current = null;
6840
+ opening.current = Boolean(id);
6761
6841
  show(id);
6762
6842
  }
6763
6843
  },
@@ -6826,6 +6906,27 @@ function Chart(props) {
6826
6906
  y2: px2(y(0))
6827
6907
  }
6828
6908
  ),
6909
+ groupFrom >= 0 && /* @__PURE__ */ jsxs43(Fragment21, { children: [
6910
+ /* @__PURE__ */ jsx47(
6911
+ "line",
6912
+ {
6913
+ className: "ui-chart__boundary",
6914
+ x1: px2(groupX),
6915
+ x2: px2(groupX),
6916
+ y1: BOUNDARY_TOP,
6917
+ y2: px2(plotHeight - PAD)
6918
+ }
6919
+ ),
6920
+ /* @__PURE__ */ jsx47(
6921
+ "text",
6922
+ {
6923
+ className: "ui-chart__text ui-chart__group",
6924
+ y: GROUP_BASELINE,
6925
+ x: px2(Math.max(0, Math.min(groupX + TEXT_GAP, plotWidth - textWidth(GROUP_WORDS, true)))),
6926
+ children: GROUP_WORDS
6927
+ }
6928
+ )
6929
+ ] }),
6829
6930
  fades.size > 0 && /* @__PURE__ */ jsx47("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs43(
6830
6931
  "linearGradient",
6831
6932
  {
@@ -6843,7 +6944,7 @@ function Chart(props) {
6843
6944
  fade.id
6844
6945
  )) }),
6845
6946
  marks.filter((m) => m.kind === "bar").map((mark) => {
6846
- const fade = fadeOf(uid, mark, variant === "bridge");
6947
+ const fade = fadeFor(mark);
6847
6948
  return /* @__PURE__ */ jsx47(
6848
6949
  "path",
6849
6950
  {
@@ -6853,11 +6954,25 @@ function Chart(props) {
6853
6954
  mark.estimated && "is-estimated"
6854
6955
  ),
6855
6956
  style: fade ? { "--ui-chart-paint": `url(#${fade.id})` } : void 0,
6856
- d: barPath(mark)
6957
+ d: fit ? barPath(mark, px2(Math.min(FIT_CORNER, mark.w / 4))) : barPath(mark)
6857
6958
  },
6858
6959
  `bar-${mark.id}`
6859
6960
  );
6860
6961
  }),
6962
+ marks.filter((m) => m.kind === "bar" && printed.has(m.id)).map((mark) => {
6963
+ const text2 = formatAxis(mark.value);
6964
+ const below = under.has(mark.id);
6965
+ return /* @__PURE__ */ jsx47(
6966
+ "text",
6967
+ {
6968
+ className: cx9("ui-chart__text", "ui-chart__value", below && "ui-chart__value--below"),
6969
+ x: px2(mark.x + mark.w / 2),
6970
+ y: px2(below ? mark.y + mark.h + TEXT_GAP : mark.y - TEXT_GAP),
6971
+ children: text2
6972
+ },
6973
+ `value-${mark.id}`
6974
+ );
6975
+ }),
6861
6976
  ["casing", "stroke"].map((layer) => lines.flatMap(
6862
6977
  (line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx47(
6863
6978
  "line",
@@ -6922,11 +7037,11 @@ function Chart(props) {
6922
7037
  }
6923
7038
  ),
6924
7039
  look?.variant === "donut" && look.look === "table" && /* @__PURE__ */ jsx47(Shares, { look, format, swatch: /* @__PURE__ */ jsx47(KeyMark, { shape: "fill" }) }),
6925
- !spark && columnsLayout && /* @__PURE__ */ jsx47("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx47(
7040
+ !spark && columnsLayout && /* @__PURE__ */ jsx47("div", { className: cx9("ui-chart__periods", every > 1 && "ui-chart__periods--step"), "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx47(
6926
7041
  "span",
6927
7042
  {
6928
- className: cx9("ui-chart__period", pick === i && "is-selected"),
6929
- children: column.short
7043
+ className: cx9("ui-chart__period", pick === i && "is-selected", every > 1 && edgeOf(i)),
7044
+ children: labelled(i) ? column.short : null
6930
7045
  },
6931
7046
  `${column.label}-${i}`
6932
7047
  )) })
@@ -1,7 +1,7 @@
1
1
  /* ============================================================================
2
2
  * Chart — .ui-chart, the shapes a money dashboard keeps redrawing.
3
3
  * .ui-chart__head the opt-in legend and the chart and table switch
4
- * .ui-chart__legend one key per series, plus the unfinished-period key
4
+ * .ui-chart__legend one key per series
5
5
  * .ui-chart__frame the tab stop; the value axis beside the scroller
6
6
  * .ui-chart__scroll the scroller
7
7
  * .ui-chart__plot the drawing and its column labels
@@ -12,8 +12,8 @@
12
12
 
13
13
  .ui-chart {
14
14
  --ui-chart-col: var(--space-12);
15
- /* The ground the marks are drawn on, so an unfinished period and the rim the
16
- line is carried on read as cut out of it. A chart outside a card names its
15
+ /* The ground the marks are drawn on, so a point and the rim the line is
16
+ carried on read as cut out of it. A chart outside a card names its
17
17
  own. */
18
18
  --ui-chart-ground: var(--surface);
19
19
  /* The tick's own line box. The axis spans the band the gridlines are drawn
@@ -65,12 +65,6 @@
65
65
  .ui-chart__key-mark { flex: none; }
66
66
  .ui-chart__key-swatch { fill: var(--ui-chart-tone); }
67
67
  .ui-chart__key-line { fill: none; stroke: var(--ui-chart-tone); stroke-width: 2; stroke-linecap: round; }
68
- .ui-chart__key-estimated {
69
- fill: var(--ui-chart-tone);
70
- stroke: var(--ui-chart-ground);
71
- stroke-width: 1;
72
- stroke-dasharray: 2 2;
73
- }
74
68
 
75
69
  /* -- the frame ------------------------------------------------------------- */
76
70
 
@@ -94,8 +88,12 @@
94
88
  display: flex;
95
89
  flex-direction: column;
96
90
  justify-content: space-between;
97
- height: calc(var(--ui-chart-h) - var(--ui-chart-pad) * 2 + var(--ui-chart-tick));
98
- margin-block: calc(var(--ui-chart-pad) - var(--ui-chart-tick) / 2);
91
+ /* The component sets the band's top and bottom edges past the room that the
92
+ group label and the bars' values take. */
93
+ height: calc(var(--ui-chart-h) - var(--ui-chart-top, var(--ui-chart-pad))
94
+ - var(--ui-chart-bottom, var(--ui-chart-pad)) + var(--ui-chart-tick));
95
+ margin-block: calc(var(--ui-chart-top, var(--ui-chart-pad)) - var(--ui-chart-tick) / 2)
96
+ calc(var(--ui-chart-bottom, var(--ui-chart-pad)) - var(--ui-chart-tick) / 2);
99
97
  text-align: right;
100
98
  font-variant-numeric: tabular-nums;
101
99
  }
@@ -110,6 +108,8 @@
110
108
  }
111
109
 
112
110
  .ui-chart__plot { min-width: calc(var(--ui-chart-col) * var(--ui-chart-cols, 1)); }
111
+ /* The months chart's periods share the card's width, so it never scrolls. */
112
+ .ui-chart--months .ui-chart__plot { min-width: 0; }
113
113
  .ui-chart__svg { display: block; }
114
114
 
115
115
  .ui-chart__periods {
@@ -133,6 +133,17 @@
133
133
  weight a reader who separates no colours still reads. Selection is otherwise
134
134
  the band behind the column and the band alone — the outline the chart draws
135
135
  belongs to focus. */
136
+ /* Where the labels do not fit, the component prints every n-th one. A printed
137
+ label keeps one line, centred on its column, or on the plot's edge. */
138
+ .ui-chart__periods--step { grid-template-columns: repeat(var(--ui-chart-cols, 1), minmax(0, 1fr)); }
139
+ .ui-chart__periods--step .ui-chart__period {
140
+ justify-self: center;
141
+ width: max-content;
142
+ padding-inline: 0;
143
+ white-space: nowrap;
144
+ }
145
+ .ui-chart__periods--step .ui-chart__period.is-start { justify-self: start; }
146
+ .ui-chart__periods--step .ui-chart__period.is-end { justify-self: end; }
136
147
  .ui-chart__period.is-selected {
137
148
  color: var(--strong);
138
149
  font-weight: 600;
@@ -172,13 +183,6 @@
172
183
  /* The ramp's two stops. Each reads the tone of the gradient that holds it. */
173
184
  .ui-chart__fade-base { stop-color: var(--ui-chart-fade); }
174
185
  .ui-chart__fade-end { stop-color: var(--ui-chart-tone); }
175
- /* Keep each series' fill. Ground-coloured dashes mark unfinished data
176
- without joining the mirrored bars across the zero channel. */
177
- .ui-chart__bar.is-estimated {
178
- stroke: var(--ui-chart-ground);
179
- stroke-width: 1;
180
- stroke-dasharray: 3 2;
181
- }
182
186
 
183
187
  /* An isolated value has no segment to draw it. Connected points need no dot. */
184
188
  .ui-chart__isolated { fill: var(--ui-chart-tone); stroke: var(--ui-chart-ground); stroke-width: 1; }
@@ -189,7 +193,6 @@
189
193
  stroke-width: 2;
190
194
  stroke-linecap: round;
191
195
  }
192
- .ui-chart__line.is-estimated { stroke-dasharray: 5 3; }
193
196
 
194
197
  /* The ground carried under the line. The line crosses bars of its own family,
195
198
  where hue alone separates them and luminance does not: a stroke of the ground
@@ -243,7 +246,7 @@
243
246
  /* The rule under the column the reader is on. It is the zero rule's weight: a
244
247
  line read across, not a mark. */
245
248
  .ui-chart__cross { stroke: var(--border-strong); stroke-width: 1; }
246
- /* A point, cut out of the ground like an unfinished bar, so two lines that
249
+ /* A point, cut out of the ground, so two lines that
247
250
  meet still show both points. */
248
251
  .ui-chart__dot { fill: var(--ui-chart-tone); stroke: var(--ui-chart-ground); stroke-width: 2; }
249
252
  .ui-chart--line-thin .ui-chart__line { stroke-width: 1.5; }
@@ -266,10 +269,16 @@
266
269
  stroke-width: 2;
267
270
  stroke-linejoin: round;
268
271
  }
269
- .ui-chart__segment.is-estimated { stroke-dasharray: 3 2; }
270
272
  /* Words drawn in the plot: a value at a line's end, a row's total, a slice's
271
273
  name. They are the chart's own figures, so they take the body ink. */
272
274
  .ui-chart__text { fill: var(--text); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
275
+ .ui-chart__value { text-anchor: middle; }
276
+ .ui-chart__value--below { dominant-baseline: hanging; }
277
+ /* The boundary before the first period that is not final, and the words over
278
+ that group. The line is the focus ring's width in the neutral chart tone, and
279
+ solid: a dash would read as a mark of its own. */
280
+ .ui-chart__boundary { stroke: var(--chart-neutral); stroke-width: var(--ring-width); }
281
+ .ui-chart__group { font-weight: var(--weight-medium); }
273
282
  .ui-chart__text--strong { fill: var(--strong); font-weight: var(--weight-semibold); }
274
283
  .ui-chart__total {
275
284
  fill: var(--strong);
@@ -352,6 +361,9 @@
352
361
  their height would hide the last period behind a second scrollbar. */
353
362
  .ui-chart__data .ui-table-scroll { --ui-table-height: none; }
354
363
  .ui-chart__data .ui-table { margin: 0; }
364
+ /* A period that is not final keeps its solid mark in the series ink: the
365
+ readout and the table name its state. */
366
+
355
367
  /* Why a period is not final is a sentence, not a label, so it wraps under the
356
368
  period it qualifies instead of carrying the money columns another two hundred
357
369
  pixels to the right of a 390px card. */