@mostra/kit 0.0.0-stage → 0.19.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 (298) hide show
  1. package/README.md +43 -2
  2. package/css/kit.css +59 -0
  3. package/css/shadcn.css +638 -0
  4. package/dist/index.d.ts +16 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +18 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/layout.d.ts +60 -0
  9. package/dist/layout.d.ts.map +1 -0
  10. package/dist/layout.js +112 -0
  11. package/dist/layout.js.map +1 -0
  12. package/dist/questionnaire.d.ts +100 -0
  13. package/dist/questionnaire.d.ts.map +1 -0
  14. package/dist/questionnaire.js +632 -0
  15. package/dist/questionnaire.js.map +1 -0
  16. package/package.json +120 -3
  17. package/registry/LICENSE.md +21 -0
  18. package/registry/base/accordion.json +19 -0
  19. package/registry/base/alert-dialog.json +21 -0
  20. package/registry/base/alert.json +18 -0
  21. package/registry/base/aspect-ratio.json +17 -0
  22. package/registry/base/attachment.json +22 -0
  23. package/registry/base/avatar.json +18 -0
  24. package/registry/base/badge.json +19 -0
  25. package/registry/base/breadcrumb.json +19 -0
  26. package/registry/base/bubble.json +19 -0
  27. package/registry/base/button-group.json +22 -0
  28. package/registry/base/button.json +19 -0
  29. package/registry/base/calendar.json +22 -0
  30. package/registry/base/card.json +17 -0
  31. package/registry/base/carousel.json +22 -0
  32. package/registry/base/chart.json +21 -0
  33. package/registry/base/checkbox.json +19 -0
  34. package/registry/base/code-block.json +23 -0
  35. package/registry/base/collapsible.json +17 -0
  36. package/registry/base/combobox.json +23 -0
  37. package/registry/base/command.json +23 -0
  38. package/registry/base/components/mostra/layout.tsx +221 -0
  39. package/registry/base/components/mostra/questionnaire.tsx +1005 -0
  40. package/registry/base/components/ui/accordion.tsx +71 -0
  41. package/registry/base/components/ui/alert-dialog.tsx +187 -0
  42. package/registry/base/components/ui/alert.tsx +75 -0
  43. package/registry/base/components/ui/aspect-ratio.tsx +22 -0
  44. package/registry/base/components/ui/attachment.tsx +207 -0
  45. package/registry/base/components/ui/avatar.tsx +108 -0
  46. package/registry/base/components/ui/badge.tsx +54 -0
  47. package/registry/base/components/ui/breadcrumb.tsx +124 -0
  48. package/registry/base/components/ui/bubble.tsx +127 -0
  49. package/registry/base/components/ui/button-group.tsx +87 -0
  50. package/registry/base/components/ui/button.tsx +57 -0
  51. package/registry/base/components/ui/calendar.tsx +221 -0
  52. package/registry/base/components/ui/card.tsx +102 -0
  53. package/registry/base/components/ui/carousel.tsx +242 -0
  54. package/registry/base/components/ui/chart.tsx +372 -0
  55. package/registry/base/components/ui/checkbox.tsx +28 -0
  56. package/registry/base/components/ui/code-block.tsx +249 -0
  57. package/registry/base/components/ui/collapsible.tsx +21 -0
  58. package/registry/base/components/ui/combobox.tsx +297 -0
  59. package/registry/base/components/ui/command.tsx +196 -0
  60. package/registry/base/components/ui/context-menu.tsx +270 -0
  61. package/registry/base/components/ui/dialog.tsx +160 -0
  62. package/registry/base/components/ui/direction.tsx +6 -0
  63. package/registry/base/components/ui/drawer.tsx +227 -0
  64. package/registry/base/components/ui/dropdown-menu.tsx +267 -0
  65. package/registry/base/components/ui/empty.tsx +103 -0
  66. package/registry/base/components/ui/field.tsx +238 -0
  67. package/registry/base/components/ui/hover-card.tsx +50 -0
  68. package/registry/base/components/ui/input-group.tsx +158 -0
  69. package/registry/base/components/ui/input-otp.tsx +86 -0
  70. package/registry/base/components/ui/input.tsx +19 -0
  71. package/registry/base/components/ui/item.tsx +201 -0
  72. package/registry/base/components/ui/kbd.tsx +26 -0
  73. package/registry/base/components/ui/label.tsx +19 -0
  74. package/registry/base/components/ui/marker.tsx +70 -0
  75. package/registry/base/components/ui/menubar.tsx +280 -0
  76. package/registry/base/components/ui/message-scroller.tsx +131 -0
  77. package/registry/base/components/ui/message.tsx +91 -0
  78. package/registry/base/components/ui/native-select.tsx +60 -0
  79. package/registry/base/components/ui/navigation-menu.tsx +167 -0
  80. package/registry/base/components/ui/pagination.tsx +130 -0
  81. package/registry/base/components/ui/popover.tsx +89 -0
  82. package/registry/base/components/ui/progress.tsx +82 -0
  83. package/registry/base/components/ui/questionnaire.tsx +324 -0
  84. package/registry/base/components/ui/radio-group.tsx +37 -0
  85. package/registry/base/components/ui/resizable.tsx +49 -0
  86. package/registry/base/components/ui/scroll-area.tsx +53 -0
  87. package/registry/base/components/ui/select.tsx +200 -0
  88. package/registry/base/components/ui/separator.tsx +24 -0
  89. package/registry/base/components/ui/sheet.tsx +138 -0
  90. package/registry/base/components/ui/sidebar.tsx +723 -0
  91. package/registry/base/components/ui/skeleton.tsx +13 -0
  92. package/registry/base/components/ui/slider.tsx +51 -0
  93. package/registry/base/components/ui/sonner.tsx +65 -0
  94. package/registry/base/components/ui/spinner.tsx +10 -0
  95. package/registry/base/components/ui/switch.tsx +31 -0
  96. package/registry/base/components/ui/table.tsx +116 -0
  97. package/registry/base/components/ui/tabs.tsx +85 -0
  98. package/registry/base/components/ui/textarea.tsx +17 -0
  99. package/registry/base/components/ui/toast.tsx +234 -0
  100. package/registry/base/components/ui/toggle-group.tsx +89 -0
  101. package/registry/base/components/ui/toggle.tsx +44 -0
  102. package/registry/base/components/ui/tooltip.tsx +65 -0
  103. package/registry/base/components/ui/trace.tsx +162 -0
  104. package/registry/base/context-menu.json +19 -0
  105. package/registry/base/dialog.json +22 -0
  106. package/registry/base/direction.json +17 -0
  107. package/registry/base/drawer.json +18 -0
  108. package/registry/base/dropdown-menu.json +19 -0
  109. package/registry/base/empty.json +18 -0
  110. package/registry/base/field.json +22 -0
  111. package/registry/base/hooks/use-highlighted-code.ts +75 -0
  112. package/registry/base/hooks/use-mobile.ts +19 -0
  113. package/registry/base/hover-card.json +18 -0
  114. package/registry/base/input-group.json +23 -0
  115. package/registry/base/input-otp.json +19 -0
  116. package/registry/base/input.json +18 -0
  117. package/registry/base/item.json +22 -0
  118. package/registry/base/kbd.json +17 -0
  119. package/registry/base/label.json +17 -0
  120. package/registry/base/lib/highlighter.tsx +124 -0
  121. package/registry/base/lib/utils.ts +1 -0
  122. package/registry/base/marker.json +19 -0
  123. package/registry/base/menubar.json +22 -0
  124. package/registry/base/message-scroller.json +22 -0
  125. package/registry/base/message.json +17 -0
  126. package/registry/base/mostra-layout.json +20 -0
  127. package/registry/base/mostra-questionnaire.json +22 -0
  128. package/registry/base/native-select.json +18 -0
  129. package/registry/base/navigation-menu.json +20 -0
  130. package/registry/base/pagination.json +21 -0
  131. package/registry/base/popover.json +18 -0
  132. package/registry/base/progress.json +18 -0
  133. package/registry/base/questionnaire.json +22 -0
  134. package/registry/base/radio-group.json +18 -0
  135. package/registry/base/registry.json +287 -0
  136. package/registry/base/resizable.json +18 -0
  137. package/registry/base/scroll-area.json +18 -0
  138. package/registry/base/select.json +19 -0
  139. package/registry/base/separator.json +18 -0
  140. package/registry/base/sheet.json +22 -0
  141. package/registry/base/sidebar.json +29 -0
  142. package/registry/base/skeleton.json +17 -0
  143. package/registry/base/slider.json +18 -0
  144. package/registry/base/sonner.json +18 -0
  145. package/registry/base/spinner.json +18 -0
  146. package/registry/base/switch.json +18 -0
  147. package/registry/base/table.json +17 -0
  148. package/registry/base/tabs.json +19 -0
  149. package/registry/base/textarea.json +17 -0
  150. package/registry/base/toast.json +22 -0
  151. package/registry/base/toggle-group.json +22 -0
  152. package/registry/base/toggle.json +19 -0
  153. package/registry/base/tooltip.json +18 -0
  154. package/registry/base/trace.json +21 -0
  155. package/registry/base/use-highlighted-code.json +21 -0
  156. package/registry/base/use-mobile.json +14 -0
  157. package/registry/base/utils.json +17 -0
  158. package/registry/radix/accordion.json +19 -0
  159. package/registry/radix/alert-dialog.json +21 -0
  160. package/registry/radix/alert.json +18 -0
  161. package/registry/radix/aspect-ratio.json +17 -0
  162. package/registry/radix/attachment.json +22 -0
  163. package/registry/radix/avatar.json +18 -0
  164. package/registry/radix/badge.json +19 -0
  165. package/registry/radix/breadcrumb.json +19 -0
  166. package/registry/radix/bubble.json +19 -0
  167. package/registry/radix/button-group.json +22 -0
  168. package/registry/radix/button.json +19 -0
  169. package/registry/radix/calendar.json +22 -0
  170. package/registry/radix/card.json +17 -0
  171. package/registry/radix/carousel.json +22 -0
  172. package/registry/radix/chart.json +18 -0
  173. package/registry/radix/checkbox.json +19 -0
  174. package/registry/radix/code-block.json +23 -0
  175. package/registry/radix/collapsible.json +17 -0
  176. package/registry/radix/combobox.json +23 -0
  177. package/registry/radix/command.json +23 -0
  178. package/registry/radix/components/mostra/layout.tsx +221 -0
  179. package/registry/radix/components/mostra/questionnaire.tsx +1005 -0
  180. package/registry/radix/components/ui/accordion.tsx +80 -0
  181. package/registry/radix/components/ui/alert-dialog.tsx +199 -0
  182. package/registry/radix/components/ui/alert.tsx +75 -0
  183. package/registry/radix/components/ui/aspect-ratio.tsx +11 -0
  184. package/registry/radix/components/ui/attachment.tsx +204 -0
  185. package/registry/radix/components/ui/avatar.tsx +111 -0
  186. package/registry/radix/components/ui/badge.tsx +51 -0
  187. package/registry/radix/components/ui/breadcrumb.tsx +121 -0
  188. package/registry/radix/components/ui/bubble.tsx +124 -0
  189. package/registry/radix/components/ui/button-group.tsx +83 -0
  190. package/registry/radix/components/ui/button.tsx +66 -0
  191. package/registry/radix/components/ui/calendar.tsx +222 -0
  192. package/registry/radix/components/ui/card.tsx +102 -0
  193. package/registry/radix/components/ui/carousel.tsx +242 -0
  194. package/registry/radix/components/ui/chart.tsx +372 -0
  195. package/registry/radix/components/ui/checkbox.tsx +32 -0
  196. package/registry/radix/components/ui/code-block.tsx +249 -0
  197. package/registry/radix/components/ui/collapsible.tsx +33 -0
  198. package/registry/radix/components/ui/combobox.tsx +299 -0
  199. package/registry/radix/components/ui/command.tsx +195 -0
  200. package/registry/radix/components/ui/context-menu.tsx +262 -0
  201. package/registry/radix/components/ui/dialog.tsx +168 -0
  202. package/registry/radix/components/ui/direction.tsx +22 -0
  203. package/registry/radix/components/ui/drawer.tsx +133 -0
  204. package/registry/radix/components/ui/dropdown-menu.tsx +268 -0
  205. package/registry/radix/components/ui/empty.tsx +103 -0
  206. package/registry/radix/components/ui/field.tsx +238 -0
  207. package/registry/radix/components/ui/hover-card.tsx +43 -0
  208. package/registry/radix/components/ui/input-group.tsx +156 -0
  209. package/registry/radix/components/ui/input-otp.tsx +86 -0
  210. package/registry/radix/components/ui/input.tsx +18 -0
  211. package/registry/radix/components/ui/item.tsx +196 -0
  212. package/registry/radix/components/ui/kbd.tsx +26 -0
  213. package/registry/radix/components/ui/label.tsx +23 -0
  214. package/registry/radix/components/ui/marker.tsx +68 -0
  215. package/registry/radix/components/ui/menubar.tsx +279 -0
  216. package/registry/radix/components/ui/message-scroller.tsx +131 -0
  217. package/registry/radix/components/ui/message.tsx +91 -0
  218. package/registry/radix/components/ui/native-select.tsx +60 -0
  219. package/registry/radix/components/ui/navigation-menu.tsx +163 -0
  220. package/registry/radix/components/ui/pagination.tsx +129 -0
  221. package/registry/radix/components/ui/popover.tsx +88 -0
  222. package/registry/radix/components/ui/progress.tsx +30 -0
  223. package/registry/radix/components/ui/questionnaire.tsx +324 -0
  224. package/registry/radix/components/ui/radio-group.tsx +43 -0
  225. package/registry/radix/components/ui/resizable.tsx +49 -0
  226. package/registry/radix/components/ui/scroll-area.tsx +54 -0
  227. package/registry/radix/components/ui/select.tsx +191 -0
  228. package/registry/radix/components/ui/separator.tsx +27 -0
  229. package/registry/radix/components/ui/sheet.tsx +147 -0
  230. package/registry/radix/components/ui/sidebar.tsx +702 -0
  231. package/registry/radix/components/ui/skeleton.tsx +13 -0
  232. package/registry/radix/components/ui/slider.tsx +62 -0
  233. package/registry/radix/components/ui/sonner.tsx +65 -0
  234. package/registry/radix/components/ui/spinner.tsx +10 -0
  235. package/registry/radix/components/ui/switch.tsx +32 -0
  236. package/registry/radix/components/ui/table.tsx +116 -0
  237. package/registry/radix/components/ui/tabs.tsx +129 -0
  238. package/registry/radix/components/ui/textarea.tsx +17 -0
  239. package/registry/radix/components/ui/toggle-group.tsx +89 -0
  240. package/registry/radix/components/ui/toggle.tsx +46 -0
  241. package/registry/radix/components/ui/tooltip.tsx +56 -0
  242. package/registry/radix/components/ui/trace.tsx +162 -0
  243. package/registry/radix/context-menu.json +19 -0
  244. package/registry/radix/dialog.json +22 -0
  245. package/registry/radix/direction.json +17 -0
  246. package/registry/radix/drawer.json +18 -0
  247. package/registry/radix/dropdown-menu.json +19 -0
  248. package/registry/radix/empty.json +18 -0
  249. package/registry/radix/field.json +22 -0
  250. package/registry/radix/hooks/use-highlighted-code.ts +75 -0
  251. package/registry/radix/hooks/use-mobile.ts +19 -0
  252. package/registry/radix/hover-card.json +18 -0
  253. package/registry/radix/input-group.json +23 -0
  254. package/registry/radix/input-otp.json +19 -0
  255. package/registry/radix/input.json +17 -0
  256. package/registry/radix/item.json +22 -0
  257. package/registry/radix/kbd.json +17 -0
  258. package/registry/radix/label.json +18 -0
  259. package/registry/radix/lib/highlighter.tsx +124 -0
  260. package/registry/radix/lib/utils.ts +1 -0
  261. package/registry/radix/marker.json +19 -0
  262. package/registry/radix/menubar.json +19 -0
  263. package/registry/radix/message-scroller.json +22 -0
  264. package/registry/radix/message.json +17 -0
  265. package/registry/radix/mostra-layout.json +20 -0
  266. package/registry/radix/mostra-questionnaire.json +22 -0
  267. package/registry/radix/native-select.json +18 -0
  268. package/registry/radix/navigation-menu.json +20 -0
  269. package/registry/radix/pagination.json +21 -0
  270. package/registry/radix/popover.json +18 -0
  271. package/registry/radix/progress.json +18 -0
  272. package/registry/radix/questionnaire.json +22 -0
  273. package/registry/radix/radio-group.json +18 -0
  274. package/registry/radix/registry.json +283 -0
  275. package/registry/radix/resizable.json +18 -0
  276. package/registry/radix/scroll-area.json +18 -0
  277. package/registry/radix/select.json +19 -0
  278. package/registry/radix/separator.json +18 -0
  279. package/registry/radix/sheet.json +22 -0
  280. package/registry/radix/sidebar.json +29 -0
  281. package/registry/radix/skeleton.json +17 -0
  282. package/registry/radix/slider.json +18 -0
  283. package/registry/radix/sonner.json +18 -0
  284. package/registry/radix/spinner.json +18 -0
  285. package/registry/radix/switch.json +18 -0
  286. package/registry/radix/table.json +17 -0
  287. package/registry/radix/tabs.json +19 -0
  288. package/registry/radix/textarea.json +17 -0
  289. package/registry/radix/toggle-group.json +22 -0
  290. package/registry/radix/toggle.json +19 -0
  291. package/registry/radix/tooltip.json +18 -0
  292. package/registry/radix/trace.json +21 -0
  293. package/registry/radix/use-highlighted-code.json +21 -0
  294. package/registry/radix/use-mobile.json +14 -0
  295. package/registry/radix/utils.json +17 -0
  296. package/src/index.ts +15 -0
  297. package/src/layout.tsx +221 -0
  298. package/src/questionnaire.tsx +1005 -0
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ //#region src/layout.d.ts
3
+ /** How wide a page's column is. */
4
+ export type PageWidth = "form" | "wide" | "full";
5
+ /** {@link Page}'s props. */
6
+ export interface PageProps extends Omit<React.ComponentProps<"main">, "title"> {
7
+ /** The page's title: what it is ("Checkout: which layout ships?"). */
8
+ readonly title?: React.ReactNode;
9
+ /** One line under the title: what the page needs, and by when. */
10
+ readonly description?: React.ReactNode;
11
+ /** A small line above the title: who sent it, when it was updated. */
12
+ readonly meta?: React.ReactNode;
13
+ /**
14
+ * Its column: `form` (the theme's measure, for answering and deciding), `wide` (for a dashboard
15
+ * or a table) or `full`. Default `form`.
16
+ */
17
+ readonly width?: PageWidth;
18
+ }
19
+ /** The page: its title and description, then its blocks, spaced as the theme spaces them. */
20
+ export declare function Page({ title, description, meta, width, className, children, ...props }: PageProps): React.JSX.Element;
21
+ /** {@link PageHeader}'s props. */
22
+ export interface PageHeaderProps extends Omit<React.ComponentProps<"header">, "title"> {
23
+ readonly title?: React.ReactNode;
24
+ readonly description?: React.ReactNode;
25
+ readonly meta?: React.ReactNode;
26
+ }
27
+ /** A page's title block, for a page laid out without {@link Page}. */
28
+ export declare function PageHeader({ title, description, meta, className, children, ...props }: PageHeaderProps): React.JSX.Element;
29
+ /** {@link Section}'s props. */
30
+ export interface SectionProps extends Omit<React.ComponentProps<"section">, "title"> {
31
+ /** Its heading. */
32
+ readonly title: React.ReactNode;
33
+ /** A line under the heading. */
34
+ readonly description?: React.ReactNode;
35
+ /** Its number, for sections that are steps in order. */
36
+ readonly index?: number;
37
+ }
38
+ /** One block of a page under its heading, as the theme marks sections (a rule, a panel). */
39
+ export declare function Section({ title, description, index, className, children, ...props }: SectionProps): React.JSX.Element;
40
+ /** {@link Figures}' props. */
41
+ export type FiguresProps = React.ComponentProps<"div">;
42
+ /** A row of figures: two to a row on a phone, all of them in one row from 40rem. */
43
+ export declare function Figures({ className, children, ...props }: FiguresProps): React.JSX.Element;
44
+ /** How a figure's change reads: better, worse, or only different. */
45
+ export type FigureTone = "good" | "bad" | "neutral";
46
+ /** {@link Figure}'s props. */
47
+ export interface FigureProps extends React.ComponentProps<"div"> {
48
+ /** What it measures ("Signups"). */
49
+ readonly label: React.ReactNode;
50
+ /** The number, formatted ("642", "€84,210"). */
51
+ readonly value: React.ReactNode;
52
+ /** Its change against a named baseline ("+5.1% vs last week"). */
53
+ readonly change?: React.ReactNode;
54
+ /** Whether the change is good, bad or neither: said in colour beside the words. Default `neutral`. */
55
+ readonly tone?: FigureTone;
56
+ }
57
+ /** One figure: its label above its value, and its change. */
58
+ export declare function Figure({ label, value, change, tone, className, ...props }: FigureProps): React.JSX.Element;
59
+ //#endregion
60
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","names":[],"sources":["../src/layout.tsx"],"mappings":";;;YAgBY;;iBAGK,kBAAkB,KAAK,MAAM;;WAEnC,QAAQ,MAAM;;WAEd,cAAc,MAAM;;WAEpB,OAAO,MAAM;;;;;WAKb,QAAQ;;;wBAUH,OACd,OACA,aACA,MACA,OACA,WACA,aACG,SACF,YAAY,MAAM,IAAI;;iBAoBR,wBAAwB,KAAK,MAAM;WACzC,QAAQ,MAAM;WACd,cAAc,MAAM;WACpB,OAAO,MAAM;;;wBAIR,aACd,OACA,aACA,MACA,WACA,aACG,SACF,kBAAkB,MAAM,IAAI;;iBAmBd,qBAAqB,KAAK,MAAM;;WAEtC,OAAO,MAAM;;WAEb,cAAc,MAAM;;WAEpB;;;wBAIK,UACd,OACA,aACA,OACA,WACA,aACG,SACF,eAAe,MAAM,IAAI;;YAoChB,eAAe,MAAM;;wBAGjB,UAAU,WAAW,aAAa,SAAS,eAAe,MAAM,IAAI;;YAgBxE;;iBAGK,oBAAoB,MAAM;;WAEhC,OAAO,MAAM;;WAEb,OAAO,MAAM;;WAEb,SAAS,MAAM;;WAEf,OAAO;;;wBAUF,SACd,OACA,OACA,QACA,MACA,cACG,SACF,cAAc,MAAM,IAAI"}
package/dist/layout.js ADDED
@@ -0,0 +1,112 @@
1
+ import { cn } from "cn";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/layout.tsx
4
+ /**
5
+ * The page's frame (KT-10's "a beautiful result without design skill"): the page with its title,
6
+ * its sections and a row of figures, each drawn from the theme's tokens (`--page-width`,
7
+ * `--stack-gap`, `--section-*`, `--figure*`), so a page that composes these looks like its theme
8
+ * in every theme, and a theme's change reaches it. Ordinary React on plain elements, the same in
9
+ * either base; every part takes `className`, and `mostra add mostra-layout` copies it into the
10
+ * artifact for editing, where the copy then wins (D68).
11
+ */
12
+ const WIDTHS = {
13
+ form: "max-w-(--page-width)",
14
+ wide: "max-w-6xl",
15
+ full: "max-w-none"
16
+ };
17
+ /** The page: its title and description, then its blocks, spaced as the theme spaces them. */
18
+ function Page({ title, description, meta, width = "form", className, children, ...props }) {
19
+ return /* @__PURE__ */ jsxs("main", {
20
+ "data-slot": "page",
21
+ className: cn("mx-auto flex w-full flex-col gap-(--stack-gap) px-5 py-(--page-pad) sm:px-8", WIDTHS[width], className),
22
+ ...props,
23
+ children: [(title !== void 0 || description !== void 0 || meta !== void 0) && /* @__PURE__ */ jsx(PageHeader, {
24
+ title,
25
+ description,
26
+ meta
27
+ }), children]
28
+ });
29
+ }
30
+ /** A page's title block, for a page laid out without {@link Page}. */
31
+ function PageHeader({ title, description, meta, className, children, ...props }) {
32
+ return /* @__PURE__ */ jsxs("header", {
33
+ "data-slot": "page-header",
34
+ className: cn("flex flex-col gap-3", className),
35
+ ...props,
36
+ children: [
37
+ meta !== void 0 && /* @__PURE__ */ jsx("div", {
38
+ className: "text-sm text-muted-foreground",
39
+ children: meta
40
+ }),
41
+ title !== void 0 && /* @__PURE__ */ jsx("h1", { children: title }),
42
+ description !== void 0 && /* @__PURE__ */ jsx("p", {
43
+ className: "max-w-[60ch] text-[1.0625rem] text-pretty text-muted-foreground",
44
+ children: description
45
+ }),
46
+ children
47
+ ]
48
+ });
49
+ }
50
+ /** One block of a page under its heading, as the theme marks sections (a rule, a panel). */
51
+ function Section({ title, description, index, className, children, ...props }) {
52
+ return /* @__PURE__ */ jsxs("section", {
53
+ "data-slot": "section",
54
+ className: cn("flex flex-col gap-8 rounded-(--section-radius) bg-(--section-bg) p-(--section-pad) shadow-(--section-shadow) [border-top:var(--section-rule)]", className),
55
+ ...props,
56
+ children: [/* @__PURE__ */ jsxs("header", {
57
+ className: "flex flex-col gap-1.5",
58
+ children: [/* @__PURE__ */ jsxs("h2", {
59
+ className: "flex items-center gap-[0.6em]",
60
+ children: [index !== void 0 && /* @__PURE__ */ jsx("span", {
61
+ "data-slot": "section-index",
62
+ "aria-hidden": true,
63
+ className: "grid size-(--section-index-size) shrink-0 place-items-center rounded-full bg-(--section-index-bg) text-[0.8em] text-(--section-index-color) tabular-nums",
64
+ children: index
65
+ }), /* @__PURE__ */ jsx("span", { children: title })]
66
+ }), description !== void 0 && /* @__PURE__ */ jsx("p", {
67
+ className: "max-w-prose text-pretty text-muted-foreground",
68
+ children: description
69
+ })]
70
+ }), children]
71
+ });
72
+ }
73
+ /** A row of figures: two to a row on a phone, all of them in one row from 40rem. */
74
+ function Figures({ className, children, ...props }) {
75
+ return /* @__PURE__ */ jsx("div", {
76
+ "data-slot": "figures",
77
+ className: cn("grid grid-cols-2 gap-(--figures-gap) divide-(--figures-divider) overflow-hidden rounded-card bg-(--figures-bg) shadow-(--figures-shadow) sm:auto-cols-fr sm:grid-flow-col sm:grid-cols-none sm:divide-x", className),
78
+ ...props,
79
+ children
80
+ });
81
+ }
82
+ const TONES = {
83
+ good: "text-success",
84
+ bad: "text-destructive",
85
+ neutral: "text-muted-foreground"
86
+ };
87
+ /** One figure: its label above its value, and its change. */
88
+ function Figure({ label, value, change, tone = "neutral", className, ...props }) {
89
+ return /* @__PURE__ */ jsxs("div", {
90
+ "data-slot": "figure",
91
+ className: cn("flex flex-col gap-1.5 rounded-(--figure-radius) bg-(--figure-bg) p-(--figure-pad)", className),
92
+ ...props,
93
+ children: [
94
+ /* @__PURE__ */ jsx("span", {
95
+ className: "text-sm text-muted-foreground",
96
+ children: label
97
+ }),
98
+ /* @__PURE__ */ jsx("span", {
99
+ className: "font-(family-name:--figure-font) text-[2rem] leading-none font-(--figure-weight) tracking-tight tabular-nums",
100
+ children: value
101
+ }),
102
+ change !== void 0 && /* @__PURE__ */ jsx("span", {
103
+ className: cn("text-sm tabular-nums", TONES[tone]),
104
+ children: change
105
+ })
106
+ ]
107
+ });
108
+ }
109
+ //#endregion
110
+ export { Figure, Figures, Page, PageHeader, Section };
111
+
112
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","names":[],"sources":["../src/layout.tsx"],"sourcesContent":["/**\n * The page's frame (KT-10's \"a beautiful result without design skill\"): the page with its title,\n * its sections and a row of figures, each drawn from the theme's tokens (`--page-width`,\n * `--stack-gap`, `--section-*`, `--figure*`), so a page that composes these looks like its theme\n * in every theme, and a theme's change reaches it. Ordinary React on plain elements, the same in\n * either base; every part takes `className`, and `mostra add mostra-layout` copies it into the\n * artifact for editing, where the copy then wins (D68).\n */\n\nimport { cn } from \"cn\";\nimport type * as React from \"react\";\n\n/* -------------------------------------------------------------------------------------------- */\n/* The page */\n\n/** How wide a page's column is. */\nexport type PageWidth = \"form\" | \"wide\" | \"full\";\n\n/** {@link Page}'s props. */\nexport interface PageProps extends Omit<React.ComponentProps<\"main\">, \"title\"> {\n /** The page's title: what it is (\"Checkout: which layout ships?\"). */\n readonly title?: React.ReactNode;\n /** One line under the title: what the page needs, and by when. */\n readonly description?: React.ReactNode;\n /** A small line above the title: who sent it, when it was updated. */\n readonly meta?: React.ReactNode;\n /**\n * Its column: `form` (the theme's measure, for answering and deciding), `wide` (for a dashboard\n * or a table) or `full`. Default `form`.\n */\n readonly width?: PageWidth;\n}\n\nconst WIDTHS: Readonly<Record<PageWidth, string>> = {\n form: \"max-w-(--page-width)\",\n wide: \"max-w-6xl\",\n full: \"max-w-none\",\n};\n\n/** The page: its title and description, then its blocks, spaced as the theme spaces them. */\nexport function Page({\n title,\n description,\n meta,\n width = \"form\",\n className,\n children,\n ...props\n}: PageProps): React.JSX.Element {\n return (\n <main\n data-slot=\"page\"\n className={cn(\n \"mx-auto flex w-full flex-col gap-(--stack-gap) px-5 py-(--page-pad) sm:px-8\",\n WIDTHS[width],\n className,\n )}\n {...props}\n >\n {(title !== undefined || description !== undefined || meta !== undefined) && (\n <PageHeader title={title} description={description} meta={meta} />\n )}\n {children}\n </main>\n );\n}\n\n/** {@link PageHeader}'s props. */\nexport interface PageHeaderProps extends Omit<React.ComponentProps<\"header\">, \"title\"> {\n readonly title?: React.ReactNode;\n readonly description?: React.ReactNode;\n readonly meta?: React.ReactNode;\n}\n\n/** A page's title block, for a page laid out without {@link Page}. */\nexport function PageHeader({\n title,\n description,\n meta,\n className,\n children,\n ...props\n}: PageHeaderProps): React.JSX.Element {\n return (\n <header data-slot=\"page-header\" className={cn(\"flex flex-col gap-3\", className)} {...props}>\n {meta !== undefined && <div className=\"text-sm text-muted-foreground\">{meta}</div>}\n {title !== undefined && <h1>{title}</h1>}\n {description !== undefined && (\n <p className=\"max-w-[60ch] text-[1.0625rem] text-pretty text-muted-foreground\">\n {description}\n </p>\n )}\n {children}\n </header>\n );\n}\n\n/* -------------------------------------------------------------------------------------------- */\n/* Sections */\n\n/** {@link Section}'s props. */\nexport interface SectionProps extends Omit<React.ComponentProps<\"section\">, \"title\"> {\n /** Its heading. */\n readonly title: React.ReactNode;\n /** A line under the heading. */\n readonly description?: React.ReactNode;\n /** Its number, for sections that are steps in order. */\n readonly index?: number;\n}\n\n/** One block of a page under its heading, as the theme marks sections (a rule, a panel). */\nexport function Section({\n title,\n description,\n index,\n className,\n children,\n ...props\n}: SectionProps): React.JSX.Element {\n return (\n <section\n data-slot=\"section\"\n className={cn(\n \"flex flex-col gap-8 rounded-(--section-radius) bg-(--section-bg) p-(--section-pad) shadow-(--section-shadow) [border-top:var(--section-rule)]\",\n className,\n )}\n {...props}\n >\n <header className=\"flex flex-col gap-1.5\">\n <h2 className=\"flex items-center gap-[0.6em]\">\n {index !== undefined && (\n <span\n data-slot=\"section-index\"\n aria-hidden\n className=\"grid size-(--section-index-size) shrink-0 place-items-center rounded-full bg-(--section-index-bg) text-[0.8em] text-(--section-index-color) tabular-nums\"\n >\n {index}\n </span>\n )}\n <span>{title}</span>\n </h2>\n {description !== undefined && (\n <p className=\"max-w-prose text-pretty text-muted-foreground\">{description}</p>\n )}\n </header>\n {children}\n </section>\n );\n}\n\n/* -------------------------------------------------------------------------------------------- */\n/* Figures */\n\n/** {@link Figures}' props. */\nexport type FiguresProps = React.ComponentProps<\"div\">;\n\n/** A row of figures: two to a row on a phone, all of them in one row from 40rem. */\nexport function Figures({ className, children, ...props }: FiguresProps): React.JSX.Element {\n return (\n <div\n data-slot=\"figures\"\n className={cn(\n \"grid grid-cols-2 gap-(--figures-gap) divide-(--figures-divider) overflow-hidden rounded-card bg-(--figures-bg) shadow-(--figures-shadow) sm:auto-cols-fr sm:grid-flow-col sm:grid-cols-none sm:divide-x\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/** How a figure's change reads: better, worse, or only different. */\nexport type FigureTone = \"good\" | \"bad\" | \"neutral\";\n\n/** {@link Figure}'s props. */\nexport interface FigureProps extends React.ComponentProps<\"div\"> {\n /** What it measures (\"Signups\"). */\n readonly label: React.ReactNode;\n /** The number, formatted (\"642\", \"€84,210\"). */\n readonly value: React.ReactNode;\n /** Its change against a named baseline (\"+5.1% vs last week\"). */\n readonly change?: React.ReactNode;\n /** Whether the change is good, bad or neither: said in colour beside the words. Default `neutral`. */\n readonly tone?: FigureTone;\n}\n\nconst TONES: Readonly<Record<FigureTone, string>> = {\n good: \"text-success\",\n bad: \"text-destructive\",\n neutral: \"text-muted-foreground\",\n};\n\n/** One figure: its label above its value, and its change. */\nexport function Figure({\n label,\n value,\n change,\n tone = \"neutral\",\n className,\n ...props\n}: FigureProps): React.JSX.Element {\n return (\n <div\n data-slot=\"figure\"\n className={cn(\n \"flex flex-col gap-1.5 rounded-(--figure-radius) bg-(--figure-bg) p-(--figure-pad)\",\n className,\n )}\n {...props}\n >\n <span className=\"text-sm text-muted-foreground\">{label}</span>\n <span className=\"font-(family-name:--figure-font) text-[2rem] leading-none font-(--figure-weight) tracking-tight tabular-nums\">\n {value}\n </span>\n {change !== undefined && (\n <span className={cn(\"text-sm tabular-nums\", TONES[tone])}>{change}</span>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAiCA,MAAM,SAA8C;CAClD,MAAM;CACN,MAAM;CACN,MAAM;AACR;;AAGA,SAAgB,KAAK,EACnB,OACA,aACA,MACA,QAAQ,QACR,WACA,UACA,GAAG,SAC4B;CAC/B,OACE,qBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,+EACA,OAAO,QACP,SACF;EACA,GAAI;EAPN,UAAA,EASI,UAAU,KAAA,KAAa,gBAAgB,KAAA,KAAa,SAAS,KAAA,MAC7D,oBAAC,YAAD;GAAmB;GAAoB;GAAmB;EAAO,CAAA,GAElE,QACG;;AAEV;;AAUA,SAAgB,WAAW,EACzB,OACA,aACA,MACA,WACA,UACA,GAAG,SACkC;CACrC,OACE,qBAAC,UAAD;EAAQ,aAAU;EAAc,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;EAArF,UAAA;GACG,SAAS,KAAA,KAAa,oBAAC,OAAD;IAAK,WAAU;IAAiC,UAAA;GAAU,CAAA;GAChF,UAAU,KAAA,KAAa,oBAAC,MAAD,EAAA,UAAK,MAAU,CAAA;GACtC,gBAAgB,KAAA,KACf,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA;GACA,CAAA;GAEJ;EACK;;AAEZ;;AAgBA,SAAgB,QAAQ,EACtB,OACA,aACA,OACA,WACA,UACA,GAAG,SAC+B;CAClC,OACE,qBAAC,WAAD;EACE,aAAU;EACV,WAAW,GACT,iJACA,SACF;EACA,GAAI;EANN,UAAA,CAQE,qBAAC,UAAD;GAAQ,WAAU;GAAlB,UAAA,CACE,qBAAC,MAAD;IAAI,WAAU;IAAd,UAAA,CACG,UAAU,KAAA,KACT,oBAAC,QAAD;KACE,aAAU;KACV,eAAA;KACA,WAAU;KAET,UAAA;IACG,CAAA,GAER,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA,CACjB;GACH,CAAA,GAAA,gBAAgB,KAAA,KACf,oBAAC,KAAD;IAAG,WAAU;IAAiD,UAAA;GAAe,CAAA,CAEzE;EACP,CAAA,GAAA,QACM;;AAEb;;AASA,SAAgB,QAAQ,EAAE,WAAW,UAAU,GAAG,SAA0C;CAC1F,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,2MACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET;AAiBA,MAAM,QAA8C;CAClD,MAAM;CACN,KAAK;CACL,SAAS;AACX;;AAGA,SAAgB,OAAO,EACrB,OACA,OACA,QACA,OAAO,WACP,WACA,GAAG,SAC8B;CACjC,OACE,qBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,qFACA,SACF;EACA,GAAI;EANN,UAAA;GAQE,oBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA;GAAY,CAAA;GAC7D,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA;GACG,CAAA;GACL,WAAW,KAAA,KACV,oBAAC,QAAD;IAAM,WAAW,GAAG,wBAAwB,MAAM,KAAK;IAAI,UAAA;GAAa,CAAA;EAEvE;;AAET"}
@@ -0,0 +1,100 @@
1
+ import * as React from "react";
2
+ //#region src/questionnaire.d.ts
3
+ interface QuestionnaireProps extends Omit<React.ComponentProps<"div">, "id" | "title"> {
4
+ /** The questionnaire's ID: every answer is the field `<id>.<question>`. */
5
+ readonly id: string;
6
+ readonly title?: React.ReactNode;
7
+ readonly description?: React.ReactNode;
8
+ /** `page` (the default): every question at once. `steps`: a section, or a question, at a time. */
9
+ readonly mode?: "page" | "steps";
10
+ /** Show how many questions are answered (the default). */
11
+ readonly progress?: boolean;
12
+ }
13
+ declare function Questionnaire({ id, title, description, mode, progress, className, children, ...props }: QuestionnaireProps): React.JSX.Element;
14
+ interface SectionProps extends Omit<React.ComponentProps<"section">, "title"> {
15
+ readonly title: React.ReactNode;
16
+ readonly description?: React.ReactNode;
17
+ /** Its number, which the questionnaire gives each of its sections in order. */
18
+ readonly index?: number;
19
+ }
20
+ declare function Section({ title, description, index, className, children, ...props }: SectionProps): React.JSX.Element;
21
+ interface QuestionProps extends Omit<React.ComponentProps<"fieldset">, "id" | "title"> {
22
+ /** The question's ID inside its questionnaire: the answer is `<questionnaire>.<id>`. */
23
+ readonly id: string;
24
+ readonly title: React.ReactNode;
25
+ /** What results call it, when the title isn't plain text. */
26
+ readonly label?: string;
27
+ readonly description?: React.ReactNode;
28
+ /** The trusted Submit waits until it is answered. */
29
+ readonly required?: boolean;
30
+ /** Its choices take several answers. */
31
+ readonly multiple?: boolean;
32
+ /** A comment beside the answer: the field `<questionnaire>.<id>.comment`. */
33
+ readonly comments?: boolean;
34
+ }
35
+ declare function Question({ id, title, label, description, required, multiple, comments, className, children, ...props }: QuestionProps): React.JSX.Element;
36
+ interface ChoiceProps {
37
+ /** The value the answer holds when this is chosen. */
38
+ readonly value: string;
39
+ readonly children: React.ReactNode;
40
+ /** What results call it, when its children aren't plain text. */
41
+ readonly label?: string;
42
+ readonly description?: React.ReactNode;
43
+ /** The option the page recommends, marked; a string names the mark ("Our pick"). */
44
+ readonly recommended?: boolean | string;
45
+ /** A figure beside it: a price, a count. */
46
+ readonly meta?: React.ReactNode;
47
+ /** A picture above it: a sketch, a screenshot. */
48
+ readonly media?: React.ReactNode;
49
+ readonly className?: string;
50
+ }
51
+ /** A choice of a question: rendered by its question, which owns the answer. */
52
+ declare function Choice(_props: ChoiceProps): React.ReactNode;
53
+ interface OtherProps {
54
+ /** Its label: "Something else" unless given. */
55
+ readonly children?: React.ReactNode;
56
+ readonly placeholder?: string;
57
+ readonly className?: string;
58
+ }
59
+ /** An answer of the person's own: chosen, then written. */
60
+ declare function Other(_props: OtherProps): React.ReactNode;
61
+ /** The mark of an answer: a giallo dot that drops in, the theme's signature move (D181 item 1). */
62
+ declare function AnswerMark({ shape }: {
63
+ readonly shape?: "circle" | "square";
64
+ }): React.JSX.Element;
65
+ interface ScaleProps {
66
+ readonly min?: number;
67
+ readonly max?: number;
68
+ /** The words at either end ("Airy", "Dense"). */
69
+ readonly labels?: readonly [string, string];
70
+ readonly className?: string;
71
+ }
72
+ declare function Scale({ min, max, labels, className }: ScaleProps): React.JSX.Element;
73
+ type RankItem = string | {
74
+ readonly value: string;
75
+ readonly label: string;
76
+ };
77
+ interface RankProps {
78
+ /** What to put in order, in the order shown first. */
79
+ readonly items: readonly RankItem[];
80
+ readonly className?: string;
81
+ }
82
+ declare function Rank({ items, className }: RankProps): React.JSX.Element;
83
+ interface TextAnswerProps {
84
+ /** Several lines (the default), or one. */
85
+ readonly multiline?: boolean;
86
+ /** For one line: what kind of text, so phones offer the right keys. */
87
+ readonly type?: "text" | "email" | "number" | "url" | "tel" | "date" | "time";
88
+ readonly placeholder?: string;
89
+ readonly className?: string;
90
+ }
91
+ declare function TextAnswer({ multiline, type, placeholder, className }: TextAnswerProps): React.JSX.Element;
92
+ interface AnswerProgressProps extends React.ComponentProps<"div"> {
93
+ readonly answered: number;
94
+ readonly total: number;
95
+ }
96
+ /** How many questions are answered: a dot for each, giallo once answered. */
97
+ declare function AnswerProgress({ answered, total, className, ...props }: AnswerProgressProps): React.JSX.Element;
98
+ //#endregion
99
+ export { AnswerMark, AnswerProgress, type AnswerProgressProps, Choice, type ChoiceProps, Other, type OtherProps, Question, type QuestionProps, Questionnaire, type QuestionnaireProps, Rank, type RankItem, type RankProps, Scale, type ScaleProps, Section, type SectionProps, TextAnswer, type TextAnswerProps };
100
+ //# sourceMappingURL=questionnaire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questionnaire.d.ts","names":[],"sources":["../src/questionnaire.tsx"],"mappings":";;UAmDU,2BAA2B,KAAK,MAAM;;WAErC;WACA,QAAQ,MAAM;WACd,cAAc,MAAM;;WAEpB;;WAEA;;iBAGF,gBACP,IACA,OACA,aACA,MACA,UACA,WACA,aACG,SACF,qBAAqB,MAAM,IAAI;UAgGxB,qBAAqB,KAAK,MAAM;WAC/B,OAAO,MAAM;WACb,cAAc,MAAM;;WAEpB;;iBAGF,UACP,OACA,aACA,OACA,WACA,aACG,SACF,eAAe,MAAM,IAAI;UAmFlB,sBAAsB,KAAK,MAAM;;WAEhC;WACA,OAAO,MAAM;;WAEb;WACA,cAAc,MAAM;;WAEpB;;WAEA;;WAEA;;iBAGF,WACP,IACA,OACA,OACA,aACA,UACA,UACA,UACA,WACA,aACG,SACF,gBAAgB,MAAM,IAAI;UAyEnB;;WAEC;WACA,UAAU,MAAM;;WAEhB;WACA,cAAc,MAAM;;WAEpB;;WAEA,OAAO,MAAM;;WAEb,QAAQ,MAAM;WACd;;;iBAIF,OAAO,QAAQ,cAAc,MAAM;UAIlC;;WAEC,WAAW,MAAM;WACjB;WACA;;;iBAOF,MAAM,QAAQ,aAAa,MAAM;;iBA0QjC,aACP;WAES;IACP,MAAM,IAAI;UA0BJ;WACC;WACA;;WAEA;WACA;;iBAGF,QAAQ,KAAS,KAAS,QAAQ,aAAa,aAAa,MAAM,IAAI;KAoE1E;WAA+B;WAAwB;;UAElD;;WAEC,gBAAgB;WAChB;;iBAGF,OAAO,OAAO,aAAa,YAAY,MAAM,IAAI;UA+EhD;;WAEC;;WAEA;WACA;WACA;;iBAGF,aACP,WACA,MACA,aACA,aACC,kBAAkB,MAAM,IAAI;UA4ErB,4BAA4B,MAAM;WACjC;WACA;;;iBAIF,iBACP,UACA,OACA,cACG,SACF,sBAAsB,MAAM,IAAI"}