altitude-design 0.2.1 → 0.3.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 (295) hide show
  1. package/README.md +41 -6
  2. package/dist/adapters/codemirror.cjs +88 -0
  3. package/dist/adapters/codemirror.cjs.map +7 -0
  4. package/dist/adapters/codemirror.js +67 -0
  5. package/dist/adapters/codemirror.js.map +7 -0
  6. package/dist/adapters/react-flow.css +102 -0
  7. package/dist/adapters/tiptap.css +71 -0
  8. package/dist/altitude.css +3121 -244
  9. package/dist/altitude.iife.js +33 -5
  10. package/dist/altitude.no-fonts.css +3121 -244
  11. package/dist/chart-themes.cjs +195 -0
  12. package/dist/chart-themes.cjs.map +7 -0
  13. package/dist/chart-themes.js +165 -0
  14. package/dist/chart-themes.js.map +7 -0
  15. package/dist/cli/altitude.mjs +134 -0
  16. package/dist/guidance/README.md +32 -0
  17. package/dist/guidance/agent-setup.md +22 -0
  18. package/dist/guidance/app-skeleton.md +17 -0
  19. package/dist/guidance/evidence.json +95 -0
  20. package/dist/guidance/index.json +493 -0
  21. package/dist/guidance/llms.txt +20 -0
  22. package/dist/guidance/manifest.json +92 -0
  23. package/dist/guidance/pattern.schema.json +181 -0
  24. package/dist/guidance/patterns/agent-action.json +77 -0
  25. package/dist/guidance/patterns/agent-action.md +39 -0
  26. package/dist/guidance/patterns/assistant-conversation.json +77 -0
  27. package/dist/guidance/patterns/assistant-conversation.md +50 -0
  28. package/dist/guidance/patterns/async-collection.json +71 -0
  29. package/dist/guidance/patterns/async-collection.md +29 -0
  30. package/dist/guidance/patterns/audit-log.json +75 -0
  31. package/dist/guidance/patterns/audit-log.md +27 -0
  32. package/dist/guidance/patterns/auth.json +86 -0
  33. package/dist/guidance/patterns/auth.md +29 -0
  34. package/dist/guidance/patterns/billing.json +80 -0
  35. package/dist/guidance/patterns/billing.md +29 -0
  36. package/dist/guidance/patterns/consequential-action.json +76 -0
  37. package/dist/guidance/patterns/consequential-action.md +27 -0
  38. package/dist/guidance/patterns/developer-settings.json +79 -0
  39. package/dist/guidance/patterns/developer-settings.md +29 -0
  40. package/dist/guidance/patterns/edit-record.json +74 -0
  41. package/dist/guidance/patterns/edit-record.md +51 -0
  42. package/dist/guidance/patterns/import.json +77 -0
  43. package/dist/guidance/patterns/import.md +31 -0
  44. package/dist/guidance/patterns/members.json +77 -0
  45. package/dist/guidance/patterns/members.md +27 -0
  46. package/dist/guidance/patterns/onboarding.json +78 -0
  47. package/dist/guidance/patterns/onboarding.md +31 -0
  48. package/dist/guidance/patterns/review-submit.json +72 -0
  49. package/dist/guidance/patterns/review-submit.md +27 -0
  50. package/dist/guidance/patterns/screen-layout.json +79 -0
  51. package/dist/guidance/patterns/screen-layout.md +40 -0
  52. package/dist/guidance/patterns/settings.json +78 -0
  53. package/dist/guidance/patterns/settings.md +32 -0
  54. package/dist/guidance/patterns/sync.json +77 -0
  55. package/dist/guidance/patterns/sync.md +31 -0
  56. package/dist/guidance/principles.md +23 -0
  57. package/dist/guidance/references/build/checks/agent-action-pattern.mjs +57 -0
  58. package/dist/guidance/references/build/checks/agent-setup.mjs +78 -0
  59. package/dist/guidance/references/build/checks/assistant-conversation-pattern.mjs +49 -0
  60. package/dist/guidance/references/build/checks/audit-log-pattern.mjs +63 -0
  61. package/dist/guidance/references/build/checks/auth-pattern.mjs +67 -0
  62. package/dist/guidance/references/build/checks/billing-pattern.mjs +63 -0
  63. package/dist/guidance/references/build/checks/developer-settings-pattern.mjs +76 -0
  64. package/dist/guidance/references/build/checks/guidance.mjs +71 -0
  65. package/dist/guidance/references/build/checks/import-pattern.mjs +69 -0
  66. package/dist/guidance/references/build/checks/members-pattern.mjs +71 -0
  67. package/dist/guidance/references/build/checks/onboarding-pattern.mjs +54 -0
  68. package/dist/guidance/references/build/checks/pattern-types.mjs +13 -0
  69. package/dist/guidance/references/build/checks/pattern-workflows.mjs +226 -0
  70. package/dist/guidance/references/build/checks/primary-scope.mjs +49 -0
  71. package/dist/guidance/references/build/checks/render-tells.mjs +72 -0
  72. package/dist/guidance/references/build/checks/screen-layout-pattern.mjs +111 -0
  73. package/dist/guidance/references/build/checks/semantics.mjs +72 -0
  74. package/dist/guidance/references/build/checks/settings-pattern.mjs +73 -0
  75. package/dist/guidance/references/build/checks/sync-pattern.mjs +62 -0
  76. package/dist/guidance/references/build/checks/tells-lint.mjs +164 -0
  77. package/dist/guidance/references/build/fixtures/pattern-workflows.tsx +83 -0
  78. package/dist/guidance/references/build/fixtures/patterns/agent-action.jsx +60 -0
  79. package/dist/guidance/references/build/fixtures/patterns/app-skeleton.jsx +94 -0
  80. package/dist/guidance/references/build/fixtures/patterns/assistant-conversation.jsx +79 -0
  81. package/dist/guidance/references/build/fixtures/patterns/audit-log.jsx +81 -0
  82. package/dist/guidance/references/build/fixtures/patterns/auth.jsx +150 -0
  83. package/dist/guidance/references/build/fixtures/patterns/billing.jsx +96 -0
  84. package/dist/guidance/references/build/fixtures/patterns/developer-settings.jsx +95 -0
  85. package/dist/guidance/references/build/fixtures/patterns/import.jsx +102 -0
  86. package/dist/guidance/references/build/fixtures/patterns/members.jsx +106 -0
  87. package/dist/guidance/references/build/fixtures/patterns/onboarding.jsx +70 -0
  88. package/dist/guidance/references/build/fixtures/patterns/screen-layout-decision.jsx +74 -0
  89. package/dist/guidance/references/build/fixtures/patterns/screen-layout-editor.jsx +56 -0
  90. package/dist/guidance/references/build/fixtures/patterns/screen-layout-report.jsx +42 -0
  91. package/dist/guidance/references/build/fixtures/patterns/settings.jsx +73 -0
  92. package/dist/guidance/references/build/fixtures/patterns/sync.jsx +78 -0
  93. package/dist/guidance/references/project/components/src/pattern-async-collection.tsx +57 -0
  94. package/dist/guidance/references/project/components/src/pattern-consequential-action.tsx +77 -0
  95. package/dist/guidance/references/project/components/src/pattern-edit-record.tsx +127 -0
  96. package/dist/guidance/references/project/components/src/pattern-review-submit.tsx +47 -0
  97. package/dist/guidance/references/project/components/src/settings.tsx +79 -0
  98. package/dist/guidance/references/scripts/build-framework-fixture.mjs +20 -0
  99. package/dist/guidance/rules.json +653 -0
  100. package/dist/guidance/visual/Elevation.md +194 -0
  101. package/dist/guidance/visual/Fundamentals.md +83 -0
  102. package/dist/guidance/visual/Research.md +1620 -0
  103. package/dist/index.cjs +18792 -1925
  104. package/dist/index.cjs.map +4 -4
  105. package/dist/index.js +18792 -1925
  106. package/dist/index.js.map +4 -4
  107. package/dist/tokens.css +84 -84
  108. package/dist/tokens.json +301 -128
  109. package/dist/types/adapter-codemirror.d.ts +13 -0
  110. package/dist/types/agent-fleet.d.ts +166 -0
  111. package/dist/types/ai-label.d.ts +30 -0
  112. package/dist/types/app-shell.d.ts +83 -0
  113. package/dist/types/area-chart.d.ts +80 -0
  114. package/dist/types/artifact.d.ts +65 -0
  115. package/dist/types/bar-chart.d.ts +83 -0
  116. package/dist/types/bar-list.d.ts +35 -0
  117. package/dist/types/breadcrumb.d.ts +62 -0
  118. package/dist/types/chart-brush.d.ts +35 -0
  119. package/dist/types/chart-themes.d.ts +229 -0
  120. package/dist/types/chart.d.ts +570 -0
  121. package/dist/types/checklist.d.ts +71 -0
  122. package/dist/types/code-block.d.ts +32 -0
  123. package/dist/types/collections.d.ts +111 -4
  124. package/dist/types/color-picker.d.ts +38 -0
  125. package/dist/types/command.d.ts +6 -3
  126. package/dist/types/comment-thread.d.ts +48 -0
  127. package/dist/types/confirmation.d.ts +60 -0
  128. package/dist/types/context-menu.d.ts +17 -0
  129. package/dist/types/controls.d.ts +100 -17
  130. package/dist/types/conversation.d.ts +130 -0
  131. package/dist/types/copy-button.d.ts +19 -0
  132. package/dist/types/core.d.ts +139 -10
  133. package/dist/types/data-grid.d.ts +76 -0
  134. package/dist/types/date-picker.d.ts +96 -0
  135. package/dist/types/diff-view.d.ts +54 -0
  136. package/dist/types/dot-plot.d.ts +54 -0
  137. package/dist/types/edit-region.d.ts +121 -0
  138. package/dist/types/feature-gate.d.ts +22 -0
  139. package/dist/types/filter-bar.d.ts +65 -0
  140. package/dist/types/formatted-number.d.ts +38 -0
  141. package/dist/types/heatmap.d.ts +64 -0
  142. package/dist/types/in-place.d.ts +24 -0
  143. package/dist/types/index.d.ts +158 -15
  144. package/dist/types/inline-citation.d.ts +35 -0
  145. package/dist/types/inline-edit.d.ts +71 -0
  146. package/dist/types/input-otp.d.ts +37 -0
  147. package/dist/types/item-group.d.ts +104 -0
  148. package/dist/types/line-chart.d.ts +116 -0
  149. package/dist/types/link.d.ts +11 -0
  150. package/dist/types/markdown.d.ts +88 -0
  151. package/dist/types/meter.d.ts +43 -0
  152. package/dist/types/modal-state.d.ts +62 -0
  153. package/dist/types/nav.d.ts +8 -1
  154. package/dist/types/notifications.d.ts +42 -0
  155. package/dist/types/number-input.d.ts +30 -0
  156. package/dist/types/overlays.d.ts +51 -17
  157. package/dist/types/page-header.d.ts +27 -0
  158. package/dist/types/pagination.d.ts +29 -0
  159. package/dist/types/palette.d.ts +64 -0
  160. package/dist/types/password-input.d.ts +22 -0
  161. package/dist/types/pattern-assistant-conversation.d.ts +55 -0
  162. package/dist/types/pattern-async-collection.d.ts +34 -0
  163. package/dist/types/pattern-consequential-action.d.ts +53 -0
  164. package/dist/types/pattern-edit-record.d.ts +72 -0
  165. package/dist/types/pattern-review-submit.d.ts +43 -0
  166. package/dist/types/permission-matrix.d.ts +34 -0
  167. package/dist/types/plan-picker.d.ts +40 -0
  168. package/dist/types/prompt-input.d.ts +106 -0
  169. package/dist/types/property-list.d.ts +67 -0
  170. package/dist/types/question.d.ts +64 -0
  171. package/dist/types/relative-time.d.ts +21 -0
  172. package/dist/types/removal-receipt.d.ts +1180 -0
  173. package/dist/types/resizable.d.ts +48 -0
  174. package/dist/types/roving.d.ts +44 -0
  175. package/dist/types/save-bar.d.ts +38 -0
  176. package/dist/types/saved-views.d.ts +72 -0
  177. package/dist/types/scatter-chart.d.ts +60 -0
  178. package/dist/types/schedule.d.ts +80 -0
  179. package/dist/types/secret-field.d.ts +33 -0
  180. package/dist/types/select.d.ts +44 -2
  181. package/dist/types/separator.d.ts +11 -0
  182. package/dist/types/settings.d.ts +39 -0
  183. package/dist/types/sheet.d.ts +1 -1
  184. package/dist/types/sparkline.d.ts +46 -0
  185. package/dist/types/split-button.d.ts +21 -0
  186. package/dist/types/stat.d.ts +54 -0
  187. package/dist/types/stepper.d.ts +6 -3
  188. package/dist/types/suggestions.d.ts +29 -0
  189. package/dist/types/suspense.d.ts +12 -1
  190. package/dist/types/sync-indicator.d.ts +24 -0
  191. package/dist/types/tag-input.d.ts +65 -0
  192. package/dist/types/terminal.d.ts +33 -0
  193. package/dist/types/thread-list.d.ts +58 -0
  194. package/dist/types/time-input.d.ts +33 -0
  195. package/dist/types/timeline.d.ts +38 -0
  196. package/dist/types/toggle.d.ts +46 -0
  197. package/dist/types/toolbar.d.ts +34 -0
  198. package/dist/types/tour.d.ts +23 -0
  199. package/dist/types/trace.d.ts +65 -0
  200. package/dist/types/tree.d.ts +71 -0
  201. package/dist/types-cjs/adapter-codemirror.d.cts +13 -0
  202. package/dist/types-cjs/agent-fleet.d.cts +166 -0
  203. package/dist/types-cjs/ai-label.d.cts +30 -0
  204. package/dist/types-cjs/app-shell.d.cts +83 -0
  205. package/dist/types-cjs/area-chart.d.cts +80 -0
  206. package/dist/types-cjs/artifact.d.cts +65 -0
  207. package/dist/types-cjs/bar-chart.d.cts +83 -0
  208. package/dist/types-cjs/bar-list.d.cts +35 -0
  209. package/dist/types-cjs/breadcrumb.d.cts +62 -0
  210. package/dist/types-cjs/chart-brush.d.cts +35 -0
  211. package/dist/types-cjs/chart-themes.d.cts +229 -0
  212. package/dist/types-cjs/chart.d.cts +570 -0
  213. package/dist/types-cjs/checklist.d.cts +71 -0
  214. package/dist/types-cjs/code-block.d.cts +32 -0
  215. package/dist/types-cjs/collections.d.cts +246 -0
  216. package/dist/types-cjs/color-picker.d.cts +38 -0
  217. package/dist/types-cjs/command.d.cts +66 -0
  218. package/dist/types-cjs/comment-thread.d.cts +48 -0
  219. package/dist/types-cjs/confirmation.d.cts +60 -0
  220. package/dist/types-cjs/context-menu.d.cts +17 -0
  221. package/dist/types-cjs/controls.d.cts +360 -0
  222. package/dist/types-cjs/conversation.d.cts +130 -0
  223. package/dist/types-cjs/copy-button.d.cts +19 -0
  224. package/dist/types-cjs/core.d.cts +256 -0
  225. package/dist/types-cjs/data-grid.d.cts +76 -0
  226. package/dist/types-cjs/date-picker.d.cts +96 -0
  227. package/dist/types-cjs/diff-view.d.cts +54 -0
  228. package/dist/types-cjs/dot-plot.d.cts +54 -0
  229. package/dist/types-cjs/edit-region.d.cts +121 -0
  230. package/dist/types-cjs/empty.d.cts +24 -0
  231. package/dist/types-cjs/feature-gate.d.cts +22 -0
  232. package/dist/types-cjs/filter-bar.d.cts +65 -0
  233. package/dist/types-cjs/formatted-number.d.cts +38 -0
  234. package/dist/types-cjs/heatmap.d.cts +64 -0
  235. package/dist/types-cjs/in-place.d.cts +24 -0
  236. package/dist/types-cjs/index.d.cts +154 -0
  237. package/dist/types-cjs/inline-citation.d.cts +35 -0
  238. package/dist/types-cjs/inline-edit.d.cts +71 -0
  239. package/dist/types-cjs/input-otp.d.cts +37 -0
  240. package/dist/types-cjs/item-group.d.cts +104 -0
  241. package/dist/types-cjs/line-chart.d.cts +116 -0
  242. package/dist/types-cjs/link.d.cts +11 -0
  243. package/dist/types-cjs/markdown.d.cts +88 -0
  244. package/dist/types-cjs/meter.d.cts +43 -0
  245. package/dist/types-cjs/modal-state.d.cts +62 -0
  246. package/dist/types-cjs/nav.d.cts +25 -0
  247. package/dist/types-cjs/notifications.d.cts +42 -0
  248. package/dist/types-cjs/number-input.d.cts +30 -0
  249. package/dist/types-cjs/overlays.d.cts +170 -0
  250. package/dist/types-cjs/page-header.d.cts +27 -0
  251. package/dist/types-cjs/pagination.d.cts +29 -0
  252. package/dist/types-cjs/palette.d.cts +64 -0
  253. package/dist/types-cjs/password-input.d.cts +22 -0
  254. package/dist/types-cjs/pattern-assistant-conversation.d.cts +55 -0
  255. package/dist/types-cjs/pattern-async-collection.d.cts +34 -0
  256. package/dist/types-cjs/pattern-consequential-action.d.cts +53 -0
  257. package/dist/types-cjs/pattern-edit-record.d.cts +72 -0
  258. package/dist/types-cjs/pattern-review-submit.d.cts +43 -0
  259. package/dist/types-cjs/permission-matrix.d.cts +34 -0
  260. package/dist/types-cjs/pile.d.cts +27 -0
  261. package/dist/types-cjs/plan-picker.d.cts +40 -0
  262. package/dist/types-cjs/prompt-input.d.cts +106 -0
  263. package/dist/types-cjs/property-list.d.cts +67 -0
  264. package/dist/types-cjs/question.d.cts +64 -0
  265. package/dist/types-cjs/relative-time.d.cts +21 -0
  266. package/dist/types-cjs/removal-receipt.d.cts +1180 -0
  267. package/dist/types-cjs/resizable.d.cts +48 -0
  268. package/dist/types-cjs/roving.d.cts +44 -0
  269. package/dist/types-cjs/save-bar.d.cts +38 -0
  270. package/dist/types-cjs/saved-views.d.cts +72 -0
  271. package/dist/types-cjs/scatter-chart.d.cts +60 -0
  272. package/dist/types-cjs/schedule.d.cts +80 -0
  273. package/dist/types-cjs/secret-field.d.cts +33 -0
  274. package/dist/types-cjs/select.d.cts +109 -0
  275. package/dist/types-cjs/separator.d.cts +11 -0
  276. package/dist/types-cjs/settings.d.cts +39 -0
  277. package/dist/types-cjs/sheet.d.cts +27 -0
  278. package/dist/types-cjs/sparkline.d.cts +46 -0
  279. package/dist/types-cjs/split-button.d.cts +21 -0
  280. package/dist/types-cjs/stat.d.cts +54 -0
  281. package/dist/types-cjs/stepper.d.cts +26 -0
  282. package/dist/types-cjs/suggestions.d.cts +29 -0
  283. package/dist/types-cjs/suspense.d.cts +85 -0
  284. package/dist/types-cjs/sync-indicator.d.cts +24 -0
  285. package/dist/types-cjs/tag-input.d.cts +65 -0
  286. package/dist/types-cjs/terminal.d.cts +33 -0
  287. package/dist/types-cjs/thread-list.d.cts +58 -0
  288. package/dist/types-cjs/time-input.d.cts +33 -0
  289. package/dist/types-cjs/timeline.d.cts +38 -0
  290. package/dist/types-cjs/toggle.d.cts +46 -0
  291. package/dist/types-cjs/toolbar.d.cts +34 -0
  292. package/dist/types-cjs/tour.d.cts +23 -0
  293. package/dist/types-cjs/trace.d.cts +65 -0
  294. package/dist/types-cjs/tree.d.cts +71 -0
  295. package/package.json +89 -9
@@ -0,0 +1,130 @@
1
+ import * as React from 'react';
2
+ export interface ConversationProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ 'aria-label': string;
4
+ }
5
+ /**
6
+ * The thread between a person and an assistant. Settled messages are the record. It follows new text to the bottom
7
+ * until the person scrolls up, then offers "Jump to latest". A streamed answer is announced once, when it completes,
8
+ * never token by token.
9
+ */
10
+ export declare function Conversation({ className, children, 'aria-label': label, ...rest }: ConversationProps): React.JSX.Element;
11
+ /** The messages, in order. */
12
+ export declare function ConversationContent({ className, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
13
+ /** "Jump to latest message": floats at level 3 once the person has scrolled up from the bottom. */
14
+ export declare function ConversationScrollButton({ className }: {
15
+ className?: string;
16
+ }): React.JSX.Element | null;
17
+ export type MessageStatus = 'streaming' | 'complete' | 'stopped' | 'error';
18
+ export interface MessageProps extends React.HTMLAttributes<HTMLElement> {
19
+ from: 'user' | 'assistant';
20
+ /** An assistant message: streaming rests on the ground with a dashed rule, "Generating…" and a caret; complete settles with one afterglow; stopped and error are kept, with Retry. Default 'complete'. */
21
+ status?: MessageStatus;
22
+ /** Who's speaking. Default "You" or "Assistant". */
23
+ name?: string;
24
+ onRetry?: () => void;
25
+ /** A person's message that was edited and resent: "Edited" in its caption. */
26
+ edited?: boolean;
27
+ }
28
+ /**
29
+ * One message. A person's is a flush accent-soft sheet; an assistant's is flush, no bubble. While an answer streams it
30
+ * isn't the record yet: it rests on the ground with a dashed rule down its edge (charts' "not yet the record"), never
31
+ * hovering, because nothing you sent is in flight. When it completes the rule goes solid and it settles once.
32
+ */
33
+ export declare function Message({ from, status, name, onRetry, edited, className, children, ...rest }: MessageProps): React.JSX.Element;
34
+ export interface MessageAttachment {
35
+ name: string;
36
+ /** Its MIME type: image/* with a `url` shows as a thumbnail; anything else as a file plate. */
37
+ type?: string;
38
+ /** In bytes, shown on a file plate. */
39
+ size?: number;
40
+ /** An image's thumbnail. */
41
+ url?: string;
42
+ /** An image's text alternative. Default its name. */
43
+ alt?: string;
44
+ /** Opens the file as a link. */
45
+ href?: string;
46
+ /** Opens the file in the app (a preview Dialog, say). */
47
+ onOpen?: () => void;
48
+ /** Expired or deleted: "No longer available", and it doesn't act. */
49
+ unavailable?: boolean;
50
+ }
51
+ export interface MessageAttachmentsProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'children'> {
52
+ items: MessageAttachment[];
53
+ }
54
+ /**
55
+ * What went with a message: the files the composer showed as plates, now settled into the record. Images are 64px
56
+ * thumbnails, other files Tag plates with name, type and size; those with href or onOpen act (and lift one level when
57
+ * pointed at). Put it before MessageContent. A sent attachment was uploaded before the message went, so it's never
58
+ * pending.
59
+ */
60
+ export declare function MessageAttachments({ items, className, ...rest }: MessageAttachmentsProps): React.JSX.Element | null;
61
+ /** The message's text. Text arrives without per-word animation; a caret marks the end while it streams. */
62
+ export declare function MessageContent({ className, children, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
63
+ export interface ConversationCheckpointProps {
64
+ /** What the point is before: "Before editing 6 files". */
65
+ label: string;
66
+ /** When it was made. */
67
+ at?: Date | string | number;
68
+ /** What restoring does, in words: "The 4 messages after this and the changes to 6 files will be set aside. You can return to them." */
69
+ consequence: string;
70
+ /** Restore: resolve when done, reject (with a message) when it couldn't. */
71
+ onRestore: () => void | Promise<unknown>;
72
+ /**
73
+ * Real recovery: bring back what restoring set aside. With it, Restore runs at once and leaves "Return to where you
74
+ * were"; without it, Restore asks first in a Dialog.
75
+ */
76
+ onReturn?: () => void | Promise<unknown>;
77
+ locale?: string;
78
+ className?: string;
79
+ }
80
+ /**
81
+ * A point in the conversation to go back to (#277): a divider with a word between its lines ("Checkpoint · Before
82
+ * editing 6 files · 2:14 PM") and Restore. Restoring follows the consequential-action contract: with onReturn it runs at
83
+ * once and leaves "Return to where you were"; without, it asks in a stationary Dialog. While restoring the label hovers
84
+ * as pending; restored, it settles once; failed, it sinks into a trench with Retry. Set the later turns aside as a
85
+ * branch (the next message's versions) rather than deleting them.
86
+ */
87
+ export declare function ConversationCheckpoint({ label, at, consequence, onRestore, onReturn, locale, className }: ConversationCheckpointProps): React.JSX.Element;
88
+ export interface QueuedMessage {
89
+ id: string;
90
+ text: string;
91
+ }
92
+ export interface ConversationQueueProps {
93
+ /** Messages written while the agent worked, in the order they'll be sent. */
94
+ items: QueuedMessage[];
95
+ /** Stop the current turn and send this one now. */
96
+ onSendNow?: (id: string) => void;
97
+ /** Edit opens it in place; called with the new text. */
98
+ onEdit?: (id: string, text: string) => void;
99
+ onRemove?: (id: string) => void;
100
+ className?: string;
101
+ }
102
+ /**
103
+ * Messages queued while the agent works (#276), between the thread and the composer, in order, each with Send now,
104
+ * Edit and Remove. A queued message is written but not dispatched, so it doesn't hover (pending is for a write in
105
+ * flight): it's the person's sheet on the ground with a dashed rim, "Queued · 1 of 2". Your app sends the first when
106
+ * the turn ends, and it becomes an ordinary message in the log.
107
+ */
108
+ export declare function ConversationQueue({ items, onSendNow, onEdit, onRemove, className }: ConversationQueueProps): React.JSX.Element | null;
109
+ export interface MessageActionsProps {
110
+ /** Shows Copy (the message's text, or this value). */
111
+ onCopy?: boolean | (() => string);
112
+ onRegenerate?: () => void;
113
+ /** Shows good / bad response toggles; null when cleared. */
114
+ onFeedback?: (value: 'up' | 'down' | null) => void;
115
+ feedback?: 'up' | 'down' | null;
116
+ /**
117
+ * Regenerated answers, or a person's edited message, are kept as versions, never overwritten: "Version 2 of 2".
118
+ * Switching is announced ("Showing version 1 of 2").
119
+ */
120
+ versions?: {
121
+ index: number;
122
+ total: number;
123
+ onChange: (index: number) => void;
124
+ };
125
+ /** A person's message: an Edit action that opens it in place; sending the edit calls this with the new text (start a branch from it). */
126
+ onEdit?: (text: string) => void;
127
+ className?: string;
128
+ }
129
+ /** Copy, regenerate, feedback and versions: ghost buttons that lift when pointed at. Hidden while the message streams. */
130
+ export declare function MessageActions({ onCopy, onRegenerate, onFeedback, feedback, versions, onEdit, className }: MessageActionsProps): React.JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { ButtonProps } from './controls.js';
3
+ export interface CopyButtonProps extends Omit<ButtonProps, 'value' | 'onCopy' | 'onError' | 'square' | 'loading' | 'leading'> {
4
+ /** What's copied, or a function that returns it (it may return a promise). */
5
+ value: string | (() => string | Promise<string>);
6
+ /** The button's name: its aria-label and Tooltip when it's icon-only, and kept as its name while it says "Copied". Default "Copy". */
7
+ label?: string;
8
+ /** Shown for dur-linger once copied. Default "Copied". */
9
+ copiedLabel?: string;
10
+ /** Shown for dur-linger when copying fails. Default "Couldn't copy". */
11
+ failedLabel?: string;
12
+ onCopy?: (value: string) => void;
13
+ onError?: (error: unknown) => void;
14
+ }
15
+ /**
16
+ * Copies a value and says so in words: pressed to the ground with a check and "Copied" for dur-linger, announced
17
+ * politely while the button keeps its name. No rise and no afterglow: nothing new arrived on the page.
18
+ */
19
+ export declare const CopyButton: React.ForwardRefExoticComponent<CopyButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
  /** useLayoutEffect in the browser, useEffect on the server, where layout effects can't run (React 18 warns about them). */
3
3
  export declare const useIsoLayoutEffect: typeof React.useEffect;
4
4
  export declare const cx: (...parts: Array<string | false | null | undefined>) => string;
5
+ /** A duration token in milliseconds. Minifiers rewrite `220ms` as `.22s`, so the unit is read, not assumed. */
6
+ export declare const cssMs: (cs: CSSStyleDeclaration | null | undefined, name: string, fallback: number) => number;
5
7
  /**
6
8
  * Mount/unmount with an exit animation. Returns `mounted` (render or not) and
7
9
  * `state` ("open" | "closed") for the data-state attribute. The element first
@@ -28,8 +30,27 @@ export declare const Icons: {
28
30
  ChevronDown: ({ size, ...rest }: IconProps) => React.JSX.Element;
29
31
  X: ({ size, ...rest }: IconProps) => React.JSX.Element;
30
32
  Info: ({ size, ...rest }: IconProps) => React.JSX.Element;
33
+ Pencil: ({ size, ...rest }: IconProps) => React.JSX.Element;
31
34
  CircleCheck: ({ size, ...rest }: IconProps) => React.JSX.Element;
32
35
  AlertCircle: ({ size, ...rest }: IconProps) => React.JSX.Element;
36
+ Copy: ({ size, ...rest }: IconProps) => React.JSX.Element;
37
+ ArrowUp: ({ size, ...rest }: IconProps) => React.JSX.Element;
38
+ Stop: ({ size, ...rest }: IconProps) => React.JSX.Element;
39
+ Paperclip: ({ size, ...rest }: IconProps) => React.JSX.Element;
40
+ ThumbsUp: ({ size, ...rest }: IconProps) => React.JSX.Element;
41
+ ThumbsDown: ({ size, ...rest }: IconProps) => React.JSX.Element;
42
+ Refresh: ({ size, ...rest }: IconProps) => React.JSX.Element;
43
+ ArrowDown: ({ size, ...rest }: IconProps) => React.JSX.Element;
44
+ Spark: ({ size, ...rest }: IconProps) => React.JSX.Element;
45
+ Lock: ({ size, ...rest }: IconProps) => React.JSX.Element;
46
+ Pin: ({ size, ...rest }: IconProps) => React.JSX.Element;
47
+ Bell: ({ size, ...rest }: IconProps) => React.JSX.Element;
48
+ Eye: ({ size, ...rest }: IconProps) => React.JSX.Element;
49
+ EyeOff: ({ size, ...rest }: IconProps) => React.JSX.Element;
50
+ Clock: ({ size, ...rest }: IconProps) => React.JSX.Element;
51
+ PanelLeft: ({ size, ...rest }: IconProps) => React.JSX.Element;
52
+ More: ({ size, ...rest }: IconProps) => React.JSX.Element;
53
+ ExternalLink: ({ size, ...rest }: IconProps) => React.JSX.Element;
33
54
  AlertTriangle: ({ size, ...rest }: IconProps) => React.JSX.Element;
34
55
  };
35
56
  export declare function Spinner({ size }: {
@@ -44,48 +65,113 @@ export declare const contrast: (a: string, b: string) => number;
44
65
  */
45
66
  export declare function deriveAccent(accent: string, surfaces: string[]): React.CSSProperties;
46
67
  declare const SURFACES: readonly ["surface-trench", "surface-well", "surface-ground", "surface-raised", "surface-lifted", "surface-floating", "surface-overlay", "surface-modal"];
47
- export type SchemeColorToken = typeof SURFACES[number] | 'ink' | 'ink-muted' | 'ink-faint' | 'line' | 'line-control' | 'accent' | 'on-accent' | 'accent-ink' | 'accent-soft' | 'positive' | 'positive-soft' | 'caution' | 'caution-soft' | 'critical' | 'critical-soft' | 'on-critical' | 'presence-1' | 'presence-2' | 'presence-3' | 'on-presence' | 'scrim';
68
+ export type SchemeColorToken = typeof SURFACES[number] | 'ink' | 'ink-muted' | 'ink-faint' | 'line' | 'line-control' | 'accent' | 'on-accent' | 'accent-ink' | 'accent-soft' | 'positive' | 'positive-soft' | 'caution' | 'caution-soft' | 'critical' | 'critical-soft' | 'on-critical' | 'presence-1' | 'presence-2' | 'presence-3' | 'on-presence' | 'scrim' | DataColorToken;
69
+ /** The data palette (charts only): categorical slots, the fold, the magnitude ramp and the diverging ramp. */
70
+ export type DataColorToken = `data-${1 | 2 | 3 | 4 | 5 | 6}` | 'data-other' | `data-seq-${1 | 2 | 3 | 4 | 5 | 6 | 7}` | `data-div-${'neg' | 'pos'}-${1 | 2 | 3}` | 'data-div-mid';
48
71
  export type SchemeShadowToken = 'trench' | 'well' | 'elev-0' | 'elev-1' | 'elev-2' | 'elev-3' | 'elev-4' | 'elev-5' | 'lip-top' | 'lip-bottom';
72
+ /** Which invariants checkScheme measures: `core` is the surface ladder and contrast, `data` the data palette's gates. */
73
+ export type SchemeCheck = 'core' | 'data';
49
74
  /**
50
75
  * Check a scheme against the invariants every scheme keeps: the surfaces climb in lightness (trench < well < ground
51
76
  * < raised ≤ … ≤ modal) and text, control edges and presence colours hold their contrast on every surface. Pass the
52
77
  * colour tokens by name (without `--`), or an element to read them from. Returns one sentence per problem; [] passes.
53
78
  * Only hex values can be measured; any other value of a checked token is reported.
79
+ *
80
+ * `include` picks the checks; it defaults to `['core']`. Add `'data'` for the data palette's gates (Theming.md, "The
81
+ * data palette"): lightness band and chroma, colour-blind and normal-vision separation, 3:1 on ground and raised,
82
+ * distance from the accent, status and presence hues, and monotone ramps.
54
83
  */
55
- export declare function checkScheme(colors: Partial<Record<SchemeColorToken, string>> | Element): string[];
84
+ export declare function checkScheme(colors: Partial<Record<SchemeColorToken, string>> | Element, options?: {
85
+ include?: SchemeCheck[];
86
+ }): string[];
56
87
  export interface CustomScheme {
57
88
  /** Stamped as data-scheme on the provider's root. */
58
89
  name: string;
59
90
  /** The built-in scheme your tokens are laid over: any token you leave out comes from it, and so does light or dark
60
- * handling (casts, rims, walls). Use nightfall or alpine for a dark scheme. Default 'daylight'. */
61
- base?: BuiltInScheme;
91
+ * handling (casts, rims, walls). Use nightfall for a dark scheme. Default 'daylight'. */
92
+ base?: BuiltInScheme | RetiredScheme;
62
93
  /** Colour and shadow tokens by name, without `--`. */
63
94
  tokens: Partial<Record<SchemeColorToken | SchemeShadowToken, string>>;
64
95
  }
65
- export type BuiltInScheme = 'daylight' | 'nightfall' | 'mesa' | 'alpine';
96
+ export type BuiltInScheme = 'daylight' | 'nightfall';
97
+ /** @deprecated Mesa and Alpine were retired because they matched generated-UI palette defaults (#324). They resolve
98
+ * to daylight and nightfall, with a warning in development. */
99
+ export type RetiredScheme = 'mesa' | 'alpine';
66
100
  /** A built-in scheme, the name of your own [data-theme="…"] block, or a CustomScheme. */
67
101
  export type Scheme = BuiltInScheme | (string & {});
68
- type Ctx = {
102
+ /** The nearest theme's portal host. Modal ownership stays private. */
103
+ export declare const useAltitude: () => {
69
104
  host: HTMLElement | null;
105
+ /** @deprecated Internal visual-only compatibility helper; use Dialog or Sheet for modal behavior. */
70
106
  pushLayer: () => () => void;
71
- };
72
- export declare const useAltitude: () => Ctx | null;
107
+ } | null;
73
108
  export interface AltitudeProviderProps extends React.HTMLAttributes<HTMLDivElement> {
74
109
  scheme?: Scheme | CustomScheme;
75
110
  accent?: string;
76
111
  motion?: 'system' | 'full' | 'reduced';
77
112
  /** 'more' renders elevation as hard, high-contrast slabs (offset = height). 'system' follows prefers-contrast. */
78
113
  contrast?: 'system' | 'more';
114
+ /**
115
+ * How large controls are (#245). 'auto' (default): today's sizes for a mouse, a step up under a coarse pointer (a
116
+ * finger), so they're big enough to hit. 'comfortable': the larger sizes everywhere (a kiosk, an accessibility
117
+ * setting). 'compact': today's sizes even on touch. Hit areas reach 44px under a coarse pointer either way.
118
+ */
119
+ density?: 'auto' | 'compact' | 'comfortable';
79
120
  recede?: boolean;
80
121
  /** Openings deepen as the pointer approaches (empty fields, a sheet's finger pull). Default true; reduced motion turns it off regardless. */
81
122
  approach?: boolean;
123
+ /**
124
+ * How content that's still on its way waits (#343). 'sweep' (default): light passes over each imprint. 'breath'
125
+ * (experimental): imprints breathe in depth on one page clock, a swell crossing the view top to bottom; content that
126
+ * rests raised (`Await settle="raised"`) rises a level past its rest and settles, flush content fills past the ground,
127
+ * and a card's parts land together. Set it on the outer provider: nested providers inherit it and can't turn it off.
128
+ */
129
+ loading?: 'sweep' | 'breath';
130
+ /**
131
+ * The whole app is in a mode people must never mistake for the normal app: test mode, viewing as a customer,
132
+ * read-only, a preview. Height can't say "this whole ground is different", so it's said in words and a border: a
133
+ * flush strip naming the mode at the top, a 2px frame around the viewport, and a plate in every Dialog and Sheet.
134
+ */
135
+ mode?: AppMode;
136
+ /**
137
+ * Development checks: warns when more than one primary Button is visible in one view (law 1). Each Dialog, Sheet and
138
+ * Popover is its own view, and <PrimaryScope> makes another. Default: on when process.env.NODE_ENV isn't 'production'.
139
+ */
140
+ devChecks?: boolean;
141
+ }
142
+ export interface AppMode {
143
+ label: string;
144
+ description?: React.ReactNode;
145
+ /** Default 'caution'. */
146
+ tone?: 'caution' | 'accent' | 'critical' | 'neutral';
147
+ /** A way out ("Leave test mode"). The strip can't be dismissed. */
148
+ action?: React.ReactNode;
82
149
  }
83
- export declare function AltitudeProvider({ scheme, accent, motion, contrast, recede, approach, className, style, children, ...rest }: AltitudeProviderProps): React.JSX.Element;
150
+ /** Opens a scope of its own for the one-primary check: an independent card on a dashboard, a dialog. */
151
+ export declare function PrimaryScope({ name, children }: {
152
+ name?: string;
153
+ children: React.ReactNode;
154
+ }): React.JSX.Element;
155
+ /** Button variant="primary" registers itself with the nearest scope while it's mounted. */
156
+ export declare function usePrimaryRegistration(el: React.RefObject<HTMLElement | null>, primary: boolean): void;
157
+ /** The provider's loading style, for the parts of loading that aren't only CSS (RevealGroup's budget, Card's grouping). */
158
+ export declare const LoadingStyleContext: React.Context<"sweep" | "breath">;
159
+ /** The app's mode, for Dialog and Sheet to name it in their headers. */
160
+ export declare const ModeContext: React.Context<AppMode | null>;
161
+ /** The mode's name as a plate, for headers of things that float above the page (Dialog, Sheet). */
162
+ export declare function ModePlate(): React.JSX.Element | null;
163
+ export declare function AltitudeProvider({ scheme, accent, motion, contrast, density, recede, approach, loading, mode, devChecks, className, style, children, ...rest }: AltitudeProviderProps): React.JSX.Element;
84
164
  /** Renders into the provider's layer host (inside the theme, outside the receding stage), else document.body. */
85
165
  export declare function Layer({ children }: {
86
166
  children: React.ReactNode;
87
167
  }): React.ReactPortal | null;
88
168
  export declare function riseDelay(): number;
169
+ /**
170
+ * Breath (loading="breath"): an imprint takes its phase from one page clock, lagged by how far down the view it sits,
171
+ * so imprints change in step (one moving thing, not many) and a slow swell of depth crosses the view. Ten seconds in,
172
+ * it calms. Returns a ref for the element whose imprints breathe; does nothing under the sweep.
173
+ */
174
+ export declare function useBreath<T extends HTMLElement>(): (el: T | null) => void;
89
175
  export type Presence = 1 | 2 | 3;
90
176
  export interface DepthProps {
91
177
  /** Afterglow. Any value: when it changes the surface lifts, tints and settles back over dur-settle. `true` settles once on mount. */
@@ -116,12 +202,55 @@ export type Level = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
116
202
  export interface SurfaceProps extends React.HTMLAttributes<HTMLElement>, DepthProps {
117
203
  level?: Level;
118
204
  interactive?: boolean;
205
+ disabled?: boolean;
206
+ type?: 'button' | 'submit' | 'reset';
207
+ href?: string;
119
208
  as?: keyof React.JSX.IntrinsicElements;
120
209
  }
121
210
  export declare const Surface: React.ForwardRefExoticComponent<SurfaceProps & React.RefAttributes<HTMLElement>>;
211
+ /**
212
+ * Keep an anchored floating panel (a tooltip, popover, menu, hover card, list) inside the viewport (#248): when it
213
+ * opens, and when the window resizes, it's measured and shifted sideways so it stays 8px clear of the screen's edges,
214
+ * on top of whatever translate its own placement uses. Its CSS caps its width at the viewport's.
215
+ */
216
+ export declare function useFitFloating(ref: React.RefObject<HTMLElement | null>, open: boolean): void;
217
+ /** How a menu or list presents itself (#249): anchored to its trigger, or as a sheet at the bottom edge. */
218
+ export type Presentation = 'auto' | 'anchored' | 'sheet';
219
+ /**
220
+ * Whether a menu or list opens as a bottom sheet: always for 'sheet', never for 'anchored', and for 'auto' on a narrow
221
+ * touch screen (under breakpoint-compact, with a coarse pointer), where the thumb is at the bottom of the screen.
222
+ */
223
+ export declare function useSheetPresentation(presentation?: Presentation): boolean;
224
+ /** A sheet-presented menu's head: its title, and a way to close it that doesn't need a tap outside. */
225
+ export declare function SheetHead({ title, onClose }: {
226
+ title?: React.ReactNode;
227
+ onClose: () => void;
228
+ }): React.JSX.Element;
229
+ /**
230
+ * Touch drags start on press-and-hold, so a swipe still scrolls (#254–#256). Call on a touch pointerdown: after
231
+ * HOLD_MS without moving more than 8px it calls onHold, and from then until the finger lifts the browser isn't
232
+ * allowed to pan (the first touchmove is cancelled) or open a long-press menu. Moving first gives the gesture to the
233
+ * browser. Returns a function that abandons the hold.
234
+ */
235
+ export declare const HOLD_MS = 400;
236
+ export declare function touchHold(e: {
237
+ clientX: number;
238
+ clientY: number;
239
+ pointerId: number;
240
+ }, onHold: () => void): () => void;
241
+ /**
242
+ * Whether the person likely has a keyboard: false on a touch-only device (no hover, a coarse pointer) until a key is
243
+ * pressed in the session, true otherwise. Components hide shortcut hints when it's false; the shortcuts still work.
244
+ */
245
+ export declare function useKeyboardLikely(): boolean;
122
246
  export interface KbdProps extends React.HTMLAttributes<HTMLElement> {
123
247
  /** A KeyboardEvent.key (case-insensitive) — the key presses down while it is held. */
124
248
  listen?: string;
249
+ /**
250
+ * Hide it on a touch-only device until a key is pressed (#262): for a hint that only makes sense with a keyboard.
251
+ * Off by default, since an app may be documenting its shortcuts on purpose. Components' own hints do this already.
252
+ */
253
+ hideOnTouch?: boolean;
125
254
  }
126
- export declare function Kbd({ listen, className, children, ...rest }: KbdProps): React.JSX.Element;
255
+ export declare function Kbd({ listen, hideOnTouch, className, children, ...rest }: KbdProps): React.JSX.Element | null;
127
256
  export {};
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ export type DataGridResult = {
3
+ ok: true;
4
+ } | {
5
+ ok: false;
6
+ error: string;
7
+ };
8
+ export interface DataGridChange<T> {
9
+ rowId: string;
10
+ key: string;
11
+ draft: unknown;
12
+ previousValue: unknown;
13
+ row: T;
14
+ }
15
+ /** What a column's custom editor receives. Spread it onto a Select or Combobox. */
16
+ export interface DataGridEditorControl {
17
+ value: any;
18
+ onValueChange: (value: any) => void;
19
+ id: string;
20
+ 'aria-label': string;
21
+ invalid: boolean;
22
+ autoFocus: true;
23
+ }
24
+ export interface DataGridColumn<T> {
25
+ key: string;
26
+ header: React.ReactNode;
27
+ /** The header as words, for cell names. Default: the header when it's a string, else the key. */
28
+ label?: string;
29
+ align?: 'start' | 'end';
30
+ editable?: boolean;
31
+ /** Text typed into the cell → the value. Default: the text. */
32
+ parse?: (text: string) => unknown;
33
+ /** The value → text in the editing field and in copies. Default: String(value ?? ''). */
34
+ format?: (value: unknown) => string;
35
+ /** Return an error to refuse a value. */
36
+ validate?: (value: any, row: T) => string | undefined;
37
+ /** Draw the cell at rest. Default: format(value). */
38
+ cell?: (row: T) => React.ReactNode;
39
+ /** A custom editor (a Select): it commits as soon as a value is chosen. */
40
+ editor?: (control: DataGridEditorControl) => React.ReactNode;
41
+ width?: number | string;
42
+ /**
43
+ * The narrowest the column gets (#260): on a phone the table scrolls inside its frame rather than squeezing a column
44
+ * below this. Default: the header's width, and at least 6rem when the table is narrow.
45
+ */
46
+ minWidth?: number | string;
47
+ /** Keep this column in view while the table scrolls sideways, over a flush 1px edge (no shadow: it isn't live). */
48
+ sticky?: boolean;
49
+ }
50
+ export interface DataGridProps<T> {
51
+ 'aria-label'?: string;
52
+ 'aria-labelledby'?: string;
53
+ rows: T[];
54
+ columns: DataGridColumn<T>[];
55
+ getRowId: (row: T) => string;
56
+ /** Names a row in each cell's name (“Price, Desk lamp”). */
57
+ getRowLabel: (row: T) => string;
58
+ /** One cell. Resolve after `rows` carries the canonical value. */
59
+ onCellSave: (change: DataGridChange<T>) => DataGridResult | Promise<DataGridResult>;
60
+ /** A paste or a cleared range, as one batch. Default: each cell through onCellSave. */
61
+ onCellsSave?: (changes: DataGridChange<T>[]) => DataGridResult | Promise<DataGridResult>;
62
+ /** Ctrl/Cmd+Z: reverse the last committed change (or batch). Omit and Ctrl+Z does nothing. */
63
+ onUndo?: (last: DataGridChange<T>[]) => void;
64
+ /** Check every cell against its column's `validate` at rest, not only while it's edited: an invalid value lies in a
65
+ * trench on critical-soft, with its problem in the cell's description. For data that arrived from elsewhere (an import). */
66
+ showInvalid?: boolean;
67
+ maxHeight?: number | string;
68
+ className?: string;
69
+ }
70
+ /**
71
+ * A table you edit cell by cell, with spreadsheet keys. Cells are the record, flush in their rows. The cell being
72
+ * edited opens into a well clipped to the cell; an invalid value deepens to a trench; when a value lands the floor
73
+ * rises flush and the cell settles. A pending cell holds a small raised plate; a failed one drops to a trench. Range
74
+ * selection is a tint, not a height: choosing a target isn't live content.
75
+ */
76
+ export declare function DataGrid<T>({ rows, columns, getRowId, getRowLabel, onCellSave, onCellsSave, onUndo, showInvalid, maxHeight, className, ...aria }: DataGridProps<T>): React.JSX.Element;
@@ -0,0 +1,96 @@
1
+ import * as React from 'react';
2
+ export type ISODate = string;
3
+ export interface DateRange {
4
+ start: ISODate | null;
5
+ end: ISODate | null;
6
+ }
7
+ /**
8
+ * A named span for DateRangePicker: a fixed range, or a function of today, so "Last 7 days" stays relative and
9
+ * re-resolves when today changes. `key` defaults to the label.
10
+ */
11
+ export interface DatePreset {
12
+ key?: string;
13
+ label: string;
14
+ range: DateRange | ((today: ISODate) => DateRange);
15
+ }
16
+ /** Ready-made relative presets. Each is a function, so labels and spans can be adjusted: `datePresets.lastDays(14)`. */
17
+ export declare const datePresets: {
18
+ today: () => DatePreset;
19
+ yesterday: () => DatePreset;
20
+ /** The last n days, today included: lastDays(7) on 27 Oct is 21–27 Oct. */
21
+ lastDays: (n: number) => DatePreset;
22
+ thisMonth: () => DatePreset;
23
+ lastMonth: () => DatePreset;
24
+ thisQuarter: () => DatePreset;
25
+ lastQuarter: () => DatePreset;
26
+ thisYear: () => DatePreset;
27
+ };
28
+ export interface CalendarProps {
29
+ value?: ISODate | null;
30
+ defaultValue?: ISODate | null;
31
+ onValueChange?: (value: ISODate) => void;
32
+ /** Earliest and latest days that can be chosen. */
33
+ min?: ISODate;
34
+ max?: ISODate;
35
+ isUnavailable?: (date: ISODate) => boolean;
36
+ /** Default: the browser's. */
37
+ locale?: string;
38
+ /** 0 Sunday … 6 Saturday. Default: the locale's. */
39
+ weekStartsOn?: number;
40
+ 'aria-label'?: string;
41
+ className?: string;
42
+ }
43
+ /** A month calendar laid on the page (level 0): no field, no panel. */
44
+ export declare function Calendar({ value, defaultValue, onValueChange, min, max, isUnavailable, locale, weekStartsOn, className, ...aria }: CalendarProps): React.JSX.Element;
45
+ interface PickerBase {
46
+ min?: ISODate;
47
+ max?: ISODate;
48
+ isUnavailable?: (date: ISODate) => boolean;
49
+ locale?: string;
50
+ weekStartsOn?: number;
51
+ /** Goes on the first segment; Field sets it so its label points here. */
52
+ id?: string;
53
+ name?: string;
54
+ disabled?: boolean;
55
+ required?: boolean;
56
+ /** Field sets it for you when it has an error. */
57
+ invalid?: boolean;
58
+ size?: 'sm' | 'md';
59
+ className?: string;
60
+ 'aria-label'?: string;
61
+ 'aria-labelledby'?: string;
62
+ 'aria-describedby'?: string;
63
+ /** Start with the calendar open (for documentation). */
64
+ defaultOpen?: boolean;
65
+ }
66
+ export interface DatePickerProps extends PickerBase {
67
+ value?: ISODate | null;
68
+ defaultValue?: ISODate | null;
69
+ /** Called with a complete, real, allowed date, or null when the field is cleared. */
70
+ onValueChange?: (value: ISODate | null) => void;
71
+ }
72
+ export interface DateRangePickerProps extends PickerBase {
73
+ value?: DateRange;
74
+ defaultValue?: DateRange;
75
+ onValueChange?: (value: DateRange) => void;
76
+ /**
77
+ * Named spans offered beside the calendar ("Last 7 days", "This quarter"): build them with `datePresets`, or pass
78
+ * `{ label, range }`. Choosing one fills the field with its name and dates; typing or picking days clears it.
79
+ */
80
+ presets?: DatePreset[];
81
+ /** The chosen preset's key, controlled; null when the range is custom. */
82
+ preset?: string | null;
83
+ /** The preset to start with, uncontrolled. Without a `defaultValue`, the range starts as this preset's. */
84
+ defaultPreset?: string | null;
85
+ onPresetChange?: (preset: string | null) => void;
86
+ /** Today, as an ISO date: relative presets resolve against it, and re-resolve when it changes. Default: the local date. */
87
+ today?: ISODate;
88
+ }
89
+ /**
90
+ * A date in a field, typed or picked. The field is an opening built like Select; its floor rises flush once it holds a
91
+ * date. The calendar floats at level 3; days are flush and the chosen one carries the raised accent mark.
92
+ */
93
+ export declare function DatePicker({ value, defaultValue, onValueChange, min, max, isUnavailable, locale, weekStartsOn, id, name, disabled, required, invalid, size, className, defaultOpen, ...aria }: DatePickerProps): React.JSX.Element;
94
+ /** Two dates as one span. In the calendar the span is a sunk track between two raised ends, the Slider's build. */
95
+ export declare function DateRangePicker({ value, defaultValue, onValueChange, min, max, isUnavailable, locale, weekStartsOn, id, name, disabled, required, invalid, size, className, defaultOpen, presets, preset: presetProp, defaultPreset, onPresetChange, today: todayProp, ...aria }: DateRangePickerProps): React.JSX.Element;
96
+ export {};
@@ -0,0 +1,54 @@
1
+ import * as React from 'react';
2
+ type Op = {
3
+ kind: 'same' | 'add' | 'del';
4
+ text: string;
5
+ };
6
+ /** Line operations for two texts. */
7
+ export declare function diffLines(before: string, after: string): Op[];
8
+ export interface DiffField {
9
+ key: string;
10
+ label: string;
11
+ format?: (value: unknown) => React.ReactNode;
12
+ }
13
+ export interface DiffViewProps {
14
+ /** 'text' (default): lines of two texts. 'properties': fields of two records. */
15
+ mode?: 'text' | 'properties';
16
+ before: string | Record<string, unknown>;
17
+ after: string | Record<string, unknown>;
18
+ /** For mode="properties": which fields, labelled. Default every key that changed. */
19
+ fields?: DiffField[];
20
+ /** Unchanged lines kept around each change; longer runs fold behind a lid. Default 3. */
21
+ context?: number;
22
+ /** What's being compared ("Version 4 → 5"). */
23
+ caption?: React.ReactNode;
24
+ /** Precomputed line operations, for large inputs. */
25
+ hunks?: Op[];
26
+ /**
27
+ * Review each change (#282, text mode): a change awaiting a decision is a proposal, so it's raised, with Accept and
28
+ * Reject; once decided it's the record again (accepted flush with one afterglow, rejected collapsed to a line). The
29
+ * header gets Accept all, Reject all and "3 of 7 changes reviewed"; n and p (or ] and [) move between undecided ones.
30
+ */
31
+ review?: boolean;
32
+ /** Decisions so far, by change id ("change-1", in order). Your app owns applying them. */
33
+ decisions?: Record<string, DiffDecision>;
34
+ onDecide?: (changeId: string, decision: DiffDecision) => void;
35
+ onDecideAll?: (decision: DiffDecision) => void;
36
+ className?: string;
37
+ }
38
+ export type DiffDecision = 'accept' | 'reject';
39
+ type Change = {
40
+ id: string;
41
+ n: number;
42
+ from: number;
43
+ to: number;
44
+ label: string;
45
+ };
46
+ /** The changes in a list of line operations: each maximal run of removals and additions, with its lines named. */
47
+ export declare function diffChanges(ops: Op[]): Change[];
48
+ /**
49
+ * What changed between two versions, in signs and words. Both versions are the record, so it lies flush. Additions are
50
+ * positive-soft with a + sign and "Added", removals critical-soft, struck through, with − and "Removed"; a changed
51
+ * property shows the old value struck through beside the new. Long unchanged runs fold behind lids. Never colour alone.
52
+ */
53
+ export declare function DiffView({ mode, before, after, fields, context, caption, hunks, review, decisions, onDecide, onDecideAll, className }: DiffViewProps): React.JSX.Element;
54
+ export {};
@@ -0,0 +1,54 @@
1
+ import * as React from 'react';
2
+ import { type ChartConfig, type ChartDatum, type ChartInfo } from './chart.js';
3
+ export interface DotPlotProps {
4
+ /** The records: one per category. undefined or a promise while they load; null or [] when there are none. */
5
+ data: ChartDatum[] | null | undefined | PromiseLike<ChartDatum[] | null>;
6
+ /** What the plot says when there's no data. */
7
+ empty?: import('./chart.js').ChartEmpty;
8
+ /** The key of each record's category, down the side. */
9
+ x: string;
10
+ /** Order the categories by value ('desc': the largest first): the first series', or `to`'s. Default: the data's order. */
11
+ sort?: 'asc' | 'desc';
12
+ /**
13
+ * A spread around each value, as the keys of its low and high ("p10", "p90"): a flat band of the series colour at 16%
14
+ * behind the dot. It joins the axis, the readout, each point's name and the table. Never error bars.
15
+ */
16
+ range?: [string, string];
17
+ /** What the spread is, in words. Default "Range". */
18
+ rangeLabel?: string;
19
+ /** The series the spread belongs to. Default the first. */
20
+ rangeSeries?: string;
21
+ /**
22
+ * Before and after per category (a dumbbell): the keys of the earlier and later values. The earlier dot is hollow, the
23
+ * later filled, joined by a 2px ink-muted link, and the change is said in words ("Up 14% from Q2").
24
+ */
25
+ from?: string;
26
+ to?: string;
27
+ /** Force zero onto the axis. Default false: a dot plot is for values where zero isn't part of the story. */
28
+ zero?: boolean;
29
+ /** Filter in place: which records match. Misses recede to 35%, keeping their place and colour. */
30
+ relevance?: (d: ChartDatum) => 'match' | 'miss' | undefined;
31
+ /** Fit the axis to the matches rather than holding it. */
32
+ rescale?: boolean;
33
+ /** Marks you can select: the selected record's category, and what to do when one is chosen (null clears). */
34
+ selected?: unknown;
35
+ onSelect?: (d: ChartDatum | null) => void;
36
+ /** Marks you drill into: the id of the current Drilldown node's child that a record opens. */
37
+ drill?: (d: ChartDatum) => string | null | undefined;
38
+ /** The crosshair and readout. Default true. */
39
+ tooltip?: boolean;
40
+ /** Series keys that keep their colours while the rest take data-context (#188). */
41
+ focus?: string[];
42
+ children?: React.ReactNode;
43
+ }
44
+ /**
45
+ * Values compared across categories where zero isn't part of the story (ten services' p95, all between 180 and 240ms),
46
+ * or averages with their spread, or before and after per category. The values are the record, so the dots lie flat on
47
+ * the ground, as a ScatterChart's do: at least 8px, a marker shape per series, ringed 2px in the plot's colour. With no
48
+ * zero there's no ground line. A spread is a flat band behind its dot, never error bars; a dumbbell joins a hollow
49
+ * "from" dot to a filled "to" dot with a 2px ink-muted link.
50
+ */
51
+ export declare function DotPlot(props: DotPlotProps): React.JSX.Element | null;
52
+ export declare namespace DotPlot {
53
+ var chartInfo: (props: Record<string, unknown>, config: ChartConfig) => ChartInfo;
54
+ }