altitude-design 0.2.0 → 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 +46 -8
  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 +3165 -246
  9. package/dist/altitude.iife.js +33 -5
  10. package/dist/altitude.no-fonts.css +3165 -246
  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 +19009 -1854
  104. package/dist/index.cjs.map +4 -4
  105. package/dist/index.js +19009 -1854
  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 +116 -5
  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 +134 -22
  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 +159 -14
  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 +56 -15
  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 +85 -0
  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 +90 -9
@@ -0,0 +1,256 @@
1
+ import * as React from 'react';
2
+ /** useLayoutEffect in the browser, useEffect on the server, where layout effects can't run (React 18 warns about them). */
3
+ export declare const useIsoLayoutEffect: typeof React.useEffect;
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;
7
+ /**
8
+ * Mount/unmount with an exit animation. Returns `mounted` (render or not) and
9
+ * `state` ("open" | "closed") for the data-state attribute. The element first
10
+ * renders in its closed pose, then flips to open two frames later so CSS
11
+ * transitions run; on close it stays mounted for `exitMs`.
12
+ */
13
+ export declare function usePresence(open: boolean, exitMs: number): {
14
+ mounted: boolean;
15
+ state: "open" | "closed";
16
+ };
17
+ export declare function useControllable<T>(value: T | undefined, defaultValue: T, onChange?: (v: T) => void): readonly [T, (v: T) => void];
18
+ export declare function useOutside(ref: React.RefObject<HTMLElement | null>, active: boolean, onOutside: () => void): void;
19
+ /** Spread on an element to make it inert. React 18 passes unknown attributes through as strings and needs ''; React 19
20
+ * knows `inert` as a boolean and treats '' as false. */
21
+ export declare const inert: React.HTMLAttributes<HTMLElement>;
22
+ export declare function useKeyFocus(): void;
23
+ /** Keeps the shared approach tracker running while any component that reacts to it is mounted. */
24
+ export declare function useApproach(enabled?: boolean): void;
25
+ type IconProps = React.SVGProps<SVGSVGElement> & {
26
+ size?: number;
27
+ };
28
+ export declare const Icons: {
29
+ Check: ({ size, ...rest }: IconProps) => React.JSX.Element;
30
+ ChevronDown: ({ size, ...rest }: IconProps) => React.JSX.Element;
31
+ X: ({ size, ...rest }: IconProps) => React.JSX.Element;
32
+ Info: ({ size, ...rest }: IconProps) => React.JSX.Element;
33
+ Pencil: ({ size, ...rest }: IconProps) => React.JSX.Element;
34
+ CircleCheck: ({ size, ...rest }: IconProps) => React.JSX.Element;
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;
54
+ AlertTriangle: ({ size, ...rest }: IconProps) => React.JSX.Element;
55
+ };
56
+ export declare function Spinner({ size }: {
57
+ size?: number;
58
+ }): React.JSX.Element;
59
+ export declare const contrast: (a: string, b: string) => number;
60
+ /**
61
+ * Derive the four accent tokens from one brand colour, against the surfaces of
62
+ * the active scheme: `accent` (as given), `on-accent` (white or ink, whichever
63
+ * reads at 4.5:1), `accent-ink` (nudged toward ink until it reads at 4.5:1 on
64
+ * every surface passed) and `accent-soft` (a tint of the ground).
65
+ */
66
+ export declare function deriveAccent(accent: string, surfaces: string[]): React.CSSProperties;
67
+ declare const SURFACES: readonly ["surface-trench", "surface-well", "surface-ground", "surface-raised", "surface-lifted", "surface-floating", "surface-overlay", "surface-modal"];
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';
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';
74
+ /**
75
+ * Check a scheme against the invariants every scheme keeps: the surfaces climb in lightness (trench < well < ground
76
+ * < raised ≤ … ≤ modal) and text, control edges and presence colours hold their contrast on every surface. Pass the
77
+ * colour tokens by name (without `--`), or an element to read them from. Returns one sentence per problem; [] passes.
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.
83
+ */
84
+ export declare function checkScheme(colors: Partial<Record<SchemeColorToken, string>> | Element, options?: {
85
+ include?: SchemeCheck[];
86
+ }): string[];
87
+ export interface CustomScheme {
88
+ /** Stamped as data-scheme on the provider's root. */
89
+ name: string;
90
+ /** The built-in scheme your tokens are laid over: any token you leave out comes from it, and so does light or dark
91
+ * handling (casts, rims, walls). Use nightfall for a dark scheme. Default 'daylight'. */
92
+ base?: BuiltInScheme | RetiredScheme;
93
+ /** Colour and shadow tokens by name, without `--`. */
94
+ tokens: Partial<Record<SchemeColorToken | SchemeShadowToken, string>>;
95
+ }
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';
100
+ /** A built-in scheme, the name of your own [data-theme="…"] block, or a CustomScheme. */
101
+ export type Scheme = BuiltInScheme | (string & {});
102
+ /** The nearest theme's portal host. Modal ownership stays private. */
103
+ export declare const useAltitude: () => {
104
+ host: HTMLElement | null;
105
+ /** @deprecated Internal visual-only compatibility helper; use Dialog or Sheet for modal behavior. */
106
+ pushLayer: () => () => void;
107
+ } | null;
108
+ export interface AltitudeProviderProps extends React.HTMLAttributes<HTMLDivElement> {
109
+ scheme?: Scheme | CustomScheme;
110
+ accent?: string;
111
+ motion?: 'system' | 'full' | 'reduced';
112
+ /** 'more' renders elevation as hard, high-contrast slabs (offset = height). 'system' follows prefers-contrast. */
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';
120
+ recede?: boolean;
121
+ /** Openings deepen as the pointer approaches (empty fields, a sheet's finger pull). Default true; reduced motion turns it off regardless. */
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;
149
+ }
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;
164
+ /** Renders into the provider's layer host (inside the theme, outside the receding stage), else document.body. */
165
+ export declare function Layer({ children }: {
166
+ children: React.ReactNode;
167
+ }): React.ReactPortal | null;
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;
175
+ export type Presence = 1 | 2 | 3;
176
+ export interface DepthProps {
177
+ /** Afterglow. Any value: when it changes the surface lifts, tints and settles back over dur-settle. `true` settles once on mount. */
178
+ settle?: unknown;
179
+ /** Commit state of an optimistic write. pending hovers above the ground (after dur-grace), committed lands, failed drops into a trench. */
180
+ status?: 'pending' | 'committed' | 'failed';
181
+ /** Someone is holding this: lifted to level 3 with their presence colour and name. */
182
+ heldBy?: {
183
+ name: string;
184
+ presence?: Presence;
185
+ } | null;
186
+ /** Focus+context. match rises one level, miss sinks into a well; nothing is removed. */
187
+ relevance?: 'match' | 'miss';
188
+ }
189
+ /** Turns depth signals into the data attributes bundle.css reads. Spread the result onto any surface. */
190
+ export declare function useDepth({ settle, status, heldBy, relevance }: DepthProps): {
191
+ 'data-settle': "a" | "b" | undefined;
192
+ 'data-land': "a" | "b" | undefined;
193
+ 'data-status': "pending" | "committed" | "failed" | undefined;
194
+ 'data-held': string | undefined;
195
+ 'data-held-by': string | undefined;
196
+ 'data-presence': string | undefined;
197
+ 'data-relevance': "match" | "miss" | undefined;
198
+ 'aria-busy': true | undefined;
199
+ style: React.CSSProperties | undefined;
200
+ };
201
+ export type Level = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5;
202
+ export interface SurfaceProps extends React.HTMLAttributes<HTMLElement>, DepthProps {
203
+ level?: Level;
204
+ interactive?: boolean;
205
+ disabled?: boolean;
206
+ type?: 'button' | 'submit' | 'reset';
207
+ href?: string;
208
+ as?: keyof React.JSX.IntrinsicElements;
209
+ }
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;
246
+ export interface KbdProps extends React.HTMLAttributes<HTMLElement> {
247
+ /** A KeyboardEvent.key (case-insensitive) — the key presses down while it is held. */
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;
254
+ }
255
+ export declare function Kbd({ listen, hideOnTouch, className, children, ...rest }: KbdProps): React.JSX.Element | null;
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.cjs';
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.cjs').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
+ }
@@ -0,0 +1,121 @@
1
+ import * as React from 'react';
2
+ type Fields<T> = Partial<Record<keyof T, string>>;
3
+ export type EditRegionSaveResult<T> = {
4
+ ok: true;
5
+ value: T;
6
+ } | {
7
+ ok: false;
8
+ error: string;
9
+ fieldErrors?: Fields<T>;
10
+ };
11
+ export interface EditRegionProps<T extends Record<string, unknown>> {
12
+ /** Names the region: “Edit <label>”. */
13
+ label: string;
14
+ /** The committed record. */
15
+ value: T;
16
+ /** Publishes the accepted canonical record, synchronously and without a network write. */
17
+ onValueChange: (canonical: T) => void;
18
+ /** The sole write. `changed` lists only the fields that differ, so you can send a patch. */
19
+ onSave: (draft: T, context: {
20
+ previousValue: T;
21
+ changed: (keyof T)[];
22
+ }) => EditRegionSaveResult<T> | Promise<EditRegionSaveResult<T>>;
23
+ /** Runs on Save. Return an error per field, or undefined. */
24
+ validate?: (draft: T) => Fields<T> | undefined | Promise<Fields<T> | undefined>;
25
+ open?: boolean;
26
+ defaultOpen?: boolean;
27
+ onOpenChange?: (open: boolean) => void;
28
+ disabled?: boolean;
29
+ /** The field focused on opening. Default: the first control in the form. */
30
+ initialFocus?: keyof T;
31
+ /** Used only when completion still owns focus and the Edit button cannot receive it. */
32
+ focusFallback?: () => HTMLElement | null;
33
+ /** Compares one field's values. Default Object.is. */
34
+ isEqual?: (a: unknown, b: unknown) => boolean;
35
+ editLabel?: string;
36
+ saveLabel?: string;
37
+ cancelLabel?: string;
38
+ /** How long the region's afterglow takes to fade after a save, in ms. Default 5000. */
39
+ settleDuration?: number;
40
+ /**
41
+ * 'form' (default): editing opens a form laid out your way. 'in-place': each value's well opens where its text is: mark
42
+ * read values with EditRegionValue, and lay the fields out where the values were. Controls take the value's font and
43
+ * reach 13px past their column on each side (the inset their text sits at), so leave 26px between columns.
44
+ */
45
+ layout?: 'form' | 'in-place';
46
+ className?: string;
47
+ /** EditRegionView and EditRegionForm. */
48
+ children: React.ReactNode;
49
+ }
50
+ /** Binds one field of the draft to a control. Spread the result onto it. */
51
+ export interface EditRegionBinder<T> {
52
+ /** Text controls (Input, Textarea): value + onChange. */
53
+ <K extends keyof T>(key: K): {
54
+ name: string;
55
+ value: T[K];
56
+ onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
57
+ readOnly: boolean;
58
+ disabled?: boolean;
59
+ 'data-field': string;
60
+ };
61
+ /** Value controls (Select, Combobox, Slider): value + onValueChange. */
62
+ value<K extends keyof T>(key: K): {
63
+ name: string;
64
+ value: T[K];
65
+ onValueChange: (value: T[K]) => void;
66
+ disabled?: boolean;
67
+ 'data-field': string;
68
+ };
69
+ /** Toggles (Switch, Checkbox): checked + onCheckedChange. */
70
+ checked<K extends keyof T>(key: K): {
71
+ checked: boolean;
72
+ onCheckedChange: (checked: boolean) => void;
73
+ disabled?: boolean;
74
+ 'data-field': string;
75
+ };
76
+ /** The field's error, for its Field. */
77
+ error(key: keyof T): string | undefined;
78
+ /** The current draft. */
79
+ draft: T;
80
+ }
81
+ /**
82
+ * Several fields of one record, edited where the record is shown and saved together as one write. Read mode is the
83
+ * record on the ground; Edit lifts it into a static raised editor holding the fields. The editor's padding is there in
84
+ * both modes (with a negative margin), so lifting changes colour and shadow, never position. The session follows
85
+ * InlineEdit: no save on blur, one write in flight, a known failure keeps the draft, and an outside change blocks Save.
86
+ */
87
+ export declare function EditRegion<T extends Record<string, unknown>>({ label, value, onValueChange, onSave, validate, open: openProp, defaultOpen, onOpenChange, disabled, initialFocus, focusFallback, isEqual, editLabel, saveLabel, cancelLabel, settleDuration, layout, className, children }: EditRegionProps<T>): React.JSX.Element;
88
+ /** Read mode: the record as text. Shows an Edit button after it unless `trigger={false}` (then place EditRegionTrigger yourself). */
89
+ export declare function EditRegionView({ children, trigger, className }: {
90
+ children?: React.ReactNode;
91
+ trigger?: boolean;
92
+ className?: string;
93
+ }): React.JSX.Element | null;
94
+ /**
95
+ * One value in read mode, named by the field that edits it. With layout 'in-place', a field whose text opens where its
96
+ * value was simply appears; one that opens elsewhere fades in. `reserve` gives the value its control's height and inset
97
+ * now, so in a list of labelled rows nothing moves at all when Edit opens.
98
+ */
99
+ export declare function EditRegionValue({ field, reserve, children, className }: {
100
+ field: string;
101
+ reserve?: boolean;
102
+ children?: React.ReactNode;
103
+ className?: string;
104
+ }): React.JSX.Element;
105
+ /** The visible Edit button. Rendered by EditRegionView by default. */
106
+ export declare function EditRegionTrigger({ children, className }: {
107
+ children?: React.ReactNode;
108
+ className?: string;
109
+ }): React.JSX.Element | null;
110
+ /**
111
+ * Edit mode: a form (or a group, inside another form) named “Edit <label>”, holding your fields, then any error and
112
+ * Save/Cancel. Children may be a function of the draft binder: `{(field) => <Input {...field('name')} />}`.
113
+ */
114
+ export declare function EditRegionForm<T extends Record<string, unknown> = Record<string, unknown>>({ children, actions, className }: {
115
+ children: React.ReactNode | ((field: EditRegionBinder<T>) => React.ReactNode);
116
+ actions?: boolean;
117
+ className?: string;
118
+ }): React.JSX.Element | null;
119
+ /** Any error, the conflict notice and Save/Cancel. EditRegionForm renders them after the fields unless `actions={false}`. */
120
+ export declare function EditRegionActions(): React.ReactNode;
121
+ export {};