gridsmith-ui 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1257,16 +1257,18 @@ type TimeZoom = "day" | "week" | "month" | "quarter";
1257
1257
  declare const TIME_ZOOMS: readonly TimeZoom[];
1258
1258
  /**
1259
1259
  * The day index of a date: "2026-03-03" → that calendar day's index; a Date or a date-time string → its local calendar
1260
- * day plus the fraction of the day its local clock shows. NaN for anything that is not a date.
1260
+ * day plus the fraction of the day its local clock shows (a day's first instant is the whole day); a number is a day
1261
+ * index already, as the scale's own functions take it. NaN for anything else: null from JSON, a string that is no date.
1261
1262
  */
1262
- declare function dayOf(value: DateInput): number;
1263
+ declare function dayOf(value: DateInput | number): number;
1263
1264
  /** Local midnight of that calendar day; a fraction adds that much of the day on the local clock. */
1264
1265
  declare function dateOfDay(day: number): Date;
1265
1266
  /**
1266
1267
  * Where a range that ends at `value` stops. A whole-day end is inclusive: "2026-03-14" (or a Date at local midnight,
1267
- * as the date pickers give) → the start of 15 March. A date-time end is half-open: it stops at that moment.
1268
+ * as the date pickers give) → the start of 15 March. A date-time end is half-open: it stops at that moment, as a day
1269
+ * index does. A range's start can make a midnight Date half-open too (scale.span, formatDateRange, timeExtent).
1268
1270
  */
1269
- declare function endDayOf(value: DateInput): number;
1271
+ declare function endDayOf(value: DateInput | number): number;
1270
1272
  interface TimeTick {
1271
1273
  /** Stable: "2026-09" for September 2026, "2026-09-07" for a day or the week starting on it, "2026-Q3", "2026". */
1272
1274
  key: string;
@@ -1278,7 +1280,10 @@ interface TimeTick {
1278
1280
  width: number;
1279
1281
  /** The weekday of the day it starts on: 0 is Sunday, as Date's getDay. */
1280
1282
  weekday: number;
1281
- /** Longest first, from Intl in the locale: ["September", "Sept", "S"], ["Mon 7", "7"], ["2026", "26"]. */
1283
+ /**
1284
+ * Longest first, from Intl in the locale: ["September", "Sept", "S"], ["Mon 7", "7"], ["2026", "26"]. Every tick in a
1285
+ * row has one form per level, so a form can repeat ("May", "May", "M").
1286
+ */
1282
1287
  labels: string[];
1283
1288
  }
1284
1289
  /** A calendar day, as shadeDays sees it: its index, its weekday (0 is Sunday) and its "YYYY-MM-DD" key. */
@@ -1299,7 +1304,8 @@ interface TimeScale {
1299
1304
  x(value: DateInput | number): number;
1300
1305
  /**
1301
1306
  * Where a range sits: px from the scale's start and its width. The end is inclusive for a whole day, as endDayOf
1302
- * (so a day's bar is never a day short); a day index is where the range stops. Default: the start's own day.
1307
+ * (so a day's bar is never a day short), but a Date at midnight after a time-of-day start is where the range stops
1308
+ * (an evening shift); a day index is where the range stops. Default: the start's own day.
1303
1309
  */
1304
1310
  span(start: DateInput | number, end?: DateInput | number): {
1305
1311
  x: number;
@@ -1324,7 +1330,10 @@ interface TimeScaleOptions {
1324
1330
  /** Inclusive for a whole day, as endDayOf. A day index is where the range stops. */
1325
1331
  end: DateInput | number;
1326
1332
  zoom: TimeZoom;
1327
- /** Default now; demos and tests pass a fixed date (a date-time gives an hourly view its "now"). */
1333
+ /**
1334
+ * Default: the moment the view mounted, on the device that shows it. The server's render, and the render that
1335
+ * hydrates its HTML, draw no today. Demos and tests pass a fixed date; a date-time gives an hourly view its "now".
1336
+ */
1328
1337
  today?: DateInput;
1329
1338
  /** Default 1 (Monday), as Calendar's. */
1330
1339
  weekStartsOn?: 0 | 1;
@@ -1343,7 +1352,7 @@ declare function useTimeScale({ start, end, zoom, today, weekStartsOn, locale, p
1343
1352
  /**
1344
1353
  * The earliest start and the latest end of some ranges, as day indices for useTimeScale: the end is where the last
1345
1354
  * range stops (inclusive for a whole day, as endDayOf), and a range with no end ends where it starts (a milestone).
1346
- * NaN for no dated range, which the scale shows as today.
1355
+ * NaN for no dated range, which the scale shows as today. A range, a start or an end that is null is skipped.
1347
1356
  */
1348
1357
  declare function timeExtent(ranges: Iterable<{
1349
1358
  start: DateInput;
@@ -1363,12 +1372,13 @@ interface DateRangeWords {
1363
1372
  }
1364
1373
  /**
1365
1374
  * A range in words, in the locale, for accessible names: "3 to 14 March", "28 September to 3 October", "16 September"
1366
- * for one day. The end is inclusive for a whole day, as endDayOf (a day index is where the range stops). A date-time
1375
+ * for one day. The end is inclusive for a whole day, as scale.span (a day index is where the range stops). A date-time
1367
1376
  * range is named by its times, and the end's day only when it differs: "Friday 23 October, 06:00 to 14:00". Intl
1368
1377
  * joins each day and time in the locale's own way, and outside English the two ends too ("10/31(土曜日)~11/01(日曜日)");
1369
- * the year shows when the two ends are in different years.
1378
+ * the year shows when the two ends are in different years. A null end is the start's own day; a start that is no date
1379
+ * gives "".
1370
1380
  */
1371
- declare function formatDateRange(start: DateInput | number, end?: DateInput | number, { locale, to, day, time }?: DateRangeWords): string;
1381
+ declare function formatDateRange(start: DateInput | number, end?: DateInput | number, words?: DateRangeWords): string;
1372
1382
 
1373
1383
  /**
1374
1384
  * What a TimeViewport gives the things drawn inside it (Sprint 25.7, Part D). The scroll position lives in a store of
@@ -1377,7 +1387,10 @@ declare function formatDateRange(start: DateInput | number, end?: DateInput | nu
1377
1387
  interface TimeViewportApi {
1378
1388
  /** Scroll so the date (or day index) sits a little clear of the pinned column ("start"), or in the middle of the view. */
1379
1389
  scrollToDate(value: DateInput | number, align?: "start" | "center"): void;
1380
- /** One visible width back or on (the previous and next period), ending on a minor tick. */
1390
+ /**
1391
+ * One visible width back or on (the previous and next period), ending on the minor tick nearest there when one is
1392
+ * within half a view of it. It always moves: where a period is wider than the view it moves by the view's width.
1393
+ */
1381
1394
  page(direction: -1 | 1): void;
1382
1395
  /**
1383
1396
  * Scroll the least to show [x0, x1] (px on the scale) clear of the pinned column. A range wider than the view is
@@ -1634,10 +1647,13 @@ type GanttTone = "neutral" | "info" | "success" | "warning" | "error" | "accent"
1634
1647
  interface GanttItem {
1635
1648
  id: string;
1636
1649
  title: string;
1637
- /** A Date, or "YYYY-MM-DD" for a calendar day in the user's zone. */
1638
- start: DateInput;
1639
- /** Inclusive for a whole day ("3 to 14 March" covers the 14th); required unless `milestone`. */
1640
- end?: DateInput;
1650
+ /**
1651
+ * A Date, or "YYYY-MM-DD" for a calendar day in the user's zone. Null for a task with no dates yet: like a date that
1652
+ * does not parse, its row says "no dates", it has no bar and no arrows, and it has no part in the scale.
1653
+ */
1654
+ start: DateInput | null;
1655
+ /** Inclusive for a whole day ("3 to 14 March" covers the 14th). Left out, the task is its start's day; a milestone uses its start alone. */
1656
+ end?: DateInput | null;
1641
1657
  /** A GanttGroup's id. */
1642
1658
  group?: string;
1643
1659
  /** A key of `statuses`. */
@@ -1655,17 +1671,23 @@ interface GanttGroup {
1655
1671
  interface GanttStatus {
1656
1672
  label: string;
1657
1673
  tone: GanttTone;
1674
+ /** The cue beside the colour, on its bars and in the legend (colour is never the only one). Default the tone's own. */
1675
+ icon?: IconName;
1658
1676
  }
1659
- interface GanttProps {
1660
- items: GanttItem[];
1677
+ interface GanttProps<T extends GanttItem = GanttItem> {
1678
+ items: T[];
1661
1679
  /** Rows grouped under collapsible headers, in this order; items with no group come last. A group with no items is left out. */
1662
1680
  groups?: GanttGroup[];
1663
- /** Controlled selection; leave it out for the Gantt to keep its own. */
1681
+ /**
1682
+ * The selected item's id. The selection is controlled once this has held a value, and from then on undefined means
1683
+ * none too, so selectedId={task?.id} works. Leave it out for the Gantt to keep its own.
1684
+ */
1664
1685
  selectedId?: string | null;
1665
1686
  /** Enter, Space or a click: the item. Escape, or a click on the selected item: null. */
1666
- onSelect?: (item: GanttItem | null) => void;
1667
- /** The bars' colours and the legend; an item with no known status is neutral. */
1687
+ onSelect?: (item: T | null) => void;
1688
+ /** The bars' colours and cues, and the legend; an item with no known status is neutral. */
1668
1689
  statuses?: Record<string, GanttStatus>;
1690
+ /** Controlled. With no onZoomChange it is fixed, and there are no zoom controls. */
1669
1691
  zoom?: TimeZoom;
1670
1692
  /** Default "week". */
1671
1693
  defaultZoom?: TimeZoom;
@@ -1677,13 +1699,18 @@ interface GanttProps {
1677
1699
  /** Default the browser's: the scale's labels and the items' dates. */
1678
1700
  locale?: string;
1679
1701
  /**
1680
- * Beside the title in the name column (assignees' avatars): shown, not announced, and left out when the column is
1681
- * too narrow for it and the title (a phone). Nothing in it may take focus.
1702
+ * Beside the title in the name column (assignees' avatars): shown, not announced (say it in `describe`), and left out
1703
+ * when the column is too narrow for it and the title (a phone). Nothing in it may take focus.
1704
+ */
1705
+ renderLabel?: (item: T) => ReactNode;
1706
+ /**
1707
+ * Words added to an item's accessible name after its title, dates, status and dependencies: what renderLabel shows
1708
+ * ("assigned to Amara Haddad"). Called as the rows render, so an inline function is fine.
1682
1709
  */
1683
- renderLabel?: (item: GanttItem) => ReactNode;
1710
+ describe?: (item: T) => string;
1684
1711
  /** The name column's heading. Default "Task". */
1685
- labelHeader?: string;
1686
- /** Controls after the built-in zoom, period and Today buttons, before the legend; false hides the bar. */
1712
+ labelHeader?: ReactNode;
1713
+ /** Controls after the built-in zoom, period and Today buttons, before the legend; false hides the bar (the legend stays). */
1687
1714
  toolbar?: ReactNode | false;
1688
1715
  "aria-label": string;
1689
1716
  className?: string;
@@ -1693,15 +1720,16 @@ interface GanttProps {
1693
1720
  * milestones and finish-to-start dependencies. Assembled from the time blocks: the scale and date model
1694
1721
  * (useTimeScale), the viewport with its pinned name column, sticky scale, zoom, pan and Today (TimeViewport), labels
1695
1722
  * that fit (TimeScaleHeader) and the one-Tab-stop keyboard (useGridKeyboard). It does no date maths and no scrolling
1696
- * of its own.
1723
+ * of its own. A task whose dates do not parse keeps its row, marked "no dates".
1697
1724
  *
1698
- * Keyboard (APG tree view): the chart is one Tab stop. Up and Down move between rows; Right opens a group, or moves
1699
- * into it; Left closes it, or moves to it; Home and End go to the first and last row; typing jumps by title. Enter or
1700
- * Space selects, and opens or closes a group; Escape clears the selection. + and − zoom and Shift+Left and Right pan,
1701
- * from the viewport. Each item's accessible name carries its title, dates, status and dependencies; the arrows and
1702
- * the scale are for sight only.
1725
+ * Keyboard (APG tree view): the chart is one Tab stop, the selected row when focus comes in from outside. Up and Down
1726
+ * move between rows; Right opens a group, or moves into it; Left closes it, or moves to it; Home and End go to the
1727
+ * first and last row; typing jumps by title. Enter or Space selects, and opens or closes a group; Escape clears the
1728
+ * selection. + and − zoom and Shift+Left and Right pan, from the viewport. When the focused row goes (a deletion, a
1729
+ * filter), focus moves to the row before it. Each item's accessible name carries its title, dates, status and
1730
+ * dependencies; the arrows and the scale are for sight only.
1703
1731
  */
1704
- declare function Gantt({ items, groups, selectedId, onSelect, statuses, zoom: zoomProp, defaultZoom, onZoomChange, today, weekStartsOn, locale, renderLabel, labelHeader, toolbar, "aria-label": ariaLabel, className, }: GanttProps): react_jsx_runtime.JSX.Element;
1732
+ declare function Gantt<T extends GanttItem = GanttItem>({ items, groups, selectedId, onSelect, statuses, zoom: zoomProp, defaultZoom, onZoomChange, today, weekStartsOn, locale, renderLabel, describe, labelHeader, toolbar, "aria-label": ariaLabel, className, }: GanttProps<T>): react_jsx_runtime.JSX.Element;
1705
1733
 
1706
1734
  type LinkUnderline = "hover" | "always" | "none";
1707
1735
  type LinkTone = "accent" | "muted" | "inherit";