@underpin/ui 0.0.0 → 2.1.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 (277) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -1
  3. package/components/autocomplete.d.ts +25 -0
  4. package/components/autocomplete.js +71 -0
  5. package/components/autocomplete.js.map +1 -0
  6. package/components/avatar.d.ts +5 -0
  7. package/components/avatar.js +26 -0
  8. package/components/avatar.js.map +1 -0
  9. package/components/badge.d.ts +36 -0
  10. package/components/badge.js +140 -0
  11. package/components/badge.js.map +1 -0
  12. package/components/bar-list.d.ts +133 -0
  13. package/components/bar-list.js +204 -0
  14. package/components/bar-list.js.map +1 -0
  15. package/components/breakdown-card.d.ts +30 -0
  16. package/components/breakdown-card.js +43 -0
  17. package/components/breakdown-card.js.map +1 -0
  18. package/components/bulk-action-bar.d.ts +21 -0
  19. package/components/bulk-action-bar.js +38 -0
  20. package/components/bulk-action-bar.js.map +1 -0
  21. package/components/button-group.d.ts +21 -0
  22. package/components/button-group.js +32 -0
  23. package/components/button-group.js.map +1 -0
  24. package/components/button.d.ts +39 -0
  25. package/components/button.js +145 -0
  26. package/components/button.js.map +1 -0
  27. package/components/calendar.d.ts +27 -0
  28. package/components/calendar.js +95 -0
  29. package/components/calendar.js.map +1 -0
  30. package/components/callout.d.ts +26 -0
  31. package/components/callout.js +71 -0
  32. package/components/callout.js.map +1 -0
  33. package/components/card.d.ts +55 -0
  34. package/components/card.js +96 -0
  35. package/components/card.js.map +1 -0
  36. package/components/chart.d.ts +32 -0
  37. package/components/chart.js +43 -0
  38. package/components/chart.js.map +1 -0
  39. package/components/checkbox.d.ts +15 -0
  40. package/components/checkbox.js +42 -0
  41. package/components/checkbox.js.map +1 -0
  42. package/components/code-block.d.ts +21 -0
  43. package/components/code-block.js +35 -0
  44. package/components/code-block.js.map +1 -0
  45. package/components/collapse.d.ts +14 -0
  46. package/components/collapse.js +25 -0
  47. package/components/collapse.js.map +1 -0
  48. package/components/combobox.d.ts +71 -0
  49. package/components/combobox.js +155 -0
  50. package/components/combobox.js.map +1 -0
  51. package/components/copy-button.d.ts +29 -0
  52. package/components/copy-button.js +100 -0
  53. package/components/copy-button.js.map +1 -0
  54. package/components/copy-input.d.ts +15 -0
  55. package/components/copy-input.js +51 -0
  56. package/components/copy-input.js.map +1 -0
  57. package/components/data-table.d.ts +120 -0
  58. package/components/data-table.js +336 -0
  59. package/components/data-table.js.map +1 -0
  60. package/components/date-picker-trigger.d.ts +12 -0
  61. package/components/date-picker-trigger.js +30 -0
  62. package/components/date-picker-trigger.js.map +1 -0
  63. package/components/date-picker.d.ts +36 -0
  64. package/components/date-picker.js +70 -0
  65. package/components/date-picker.js.map +1 -0
  66. package/components/detail-row.d.ts +51 -0
  67. package/components/detail-row.js +77 -0
  68. package/components/detail-row.js.map +1 -0
  69. package/components/dialog.d.ts +121 -0
  70. package/components/dialog.js +327 -0
  71. package/components/dialog.js.map +1 -0
  72. package/components/disabled-reason.d.ts +31 -0
  73. package/components/disabled-reason.js +67 -0
  74. package/components/disabled-reason.js.map +1 -0
  75. package/components/empty-state.d.ts +41 -0
  76. package/components/empty-state.js +84 -0
  77. package/components/empty-state.js.map +1 -0
  78. package/components/entity-avatar.d.ts +54 -0
  79. package/components/entity-avatar.js +68 -0
  80. package/components/entity-avatar.js.map +1 -0
  81. package/components/form-section.d.ts +22 -0
  82. package/components/form-section.js +38 -0
  83. package/components/form-section.js.map +1 -0
  84. package/components/form.d.ts +199 -0
  85. package/components/form.js +456 -0
  86. package/components/form.js.map +1 -0
  87. package/components/formatted-number.d.ts +21 -0
  88. package/components/formatted-number.js +13 -0
  89. package/components/formatted-number.js.map +1 -0
  90. package/components/heading.d.ts +23 -0
  91. package/components/heading.js +44 -0
  92. package/components/heading.js.map +1 -0
  93. package/components/icon-swap.d.ts +15 -0
  94. package/components/icon-swap.js +29 -0
  95. package/components/icon-swap.js.map +1 -0
  96. package/components/inline-action.d.ts +21 -0
  97. package/components/inline-action.js +36 -0
  98. package/components/inline-action.js.map +1 -0
  99. package/components/input.d.ts +51 -0
  100. package/components/input.js +52 -0
  101. package/components/input.js.map +1 -0
  102. package/components/kbd.d.ts +17 -0
  103. package/components/kbd.js +34 -0
  104. package/components/kbd.js.map +1 -0
  105. package/components/label.d.ts +10 -0
  106. package/components/label.js +20 -0
  107. package/components/label.js.map +1 -0
  108. package/components/menu.d.ts +77 -0
  109. package/components/menu.js +189 -0
  110. package/components/menu.js.map +1 -0
  111. package/components/nav-button.d.ts +34 -0
  112. package/components/nav-button.js +71 -0
  113. package/components/nav-button.js.map +1 -0
  114. package/components/nav.d.ts +39 -0
  115. package/components/nav.js +68 -0
  116. package/components/nav.js.map +1 -0
  117. package/components/number-input.d.ts +16 -0
  118. package/components/number-input.js +25 -0
  119. package/components/number-input.js.map +1 -0
  120. package/components/page.d.ts +14 -0
  121. package/components/page.js +23 -0
  122. package/components/page.js.map +1 -0
  123. package/components/pagination.d.ts +73 -0
  124. package/components/pagination.js +212 -0
  125. package/components/pagination.js.map +1 -0
  126. package/components/ping.d.ts +38 -0
  127. package/components/ping.js +50 -0
  128. package/components/ping.js.map +1 -0
  129. package/components/popover.d.ts +5 -0
  130. package/components/popover.js +25 -0
  131. package/components/popover.js.map +1 -0
  132. package/components/radio-group.d.ts +35 -0
  133. package/components/radio-group.js +81 -0
  134. package/components/radio-group.js.map +1 -0
  135. package/components/relative-time.d.ts +25 -0
  136. package/components/relative-time.js +51 -0
  137. package/components/relative-time.js.map +1 -0
  138. package/components/saved-mark.d.ts +15 -0
  139. package/components/saved-mark.js +45 -0
  140. package/components/saved-mark.js.map +1 -0
  141. package/components/search-input.d.ts +13 -0
  142. package/components/search-input.js +44 -0
  143. package/components/search-input.js.map +1 -0
  144. package/components/section-header.d.ts +83 -0
  145. package/components/section-header.js +170 -0
  146. package/components/section-header.js.map +1 -0
  147. package/components/segmented-control.d.ts +24 -0
  148. package/components/segmented-control.js +70 -0
  149. package/components/segmented-control.js.map +1 -0
  150. package/components/select.d.ts +28 -0
  151. package/components/select.js +129 -0
  152. package/components/select.js.map +1 -0
  153. package/components/shortcut-keys.d.ts +14 -0
  154. package/components/shortcut-keys.js +32 -0
  155. package/components/shortcut-keys.js.map +1 -0
  156. package/components/shortcuts-dialog.d.ts +10 -0
  157. package/components/shortcuts-dialog.js +92 -0
  158. package/components/shortcuts-dialog.js.map +1 -0
  159. package/components/skeleton.d.ts +8 -0
  160. package/components/skeleton.js +23 -0
  161. package/components/skeleton.js.map +1 -0
  162. package/components/sparkline.d.ts +25 -0
  163. package/components/sparkline.js +70 -0
  164. package/components/sparkline.js.map +1 -0
  165. package/components/stack.d.ts +21 -0
  166. package/components/stack.js +45 -0
  167. package/components/stack.js.map +1 -0
  168. package/components/stat-strip.d.ts +43 -0
  169. package/components/stat-strip.js +151 -0
  170. package/components/stat-strip.js.map +1 -0
  171. package/components/steps.d.ts +19 -0
  172. package/components/steps.js +25 -0
  173. package/components/steps.js.map +1 -0
  174. package/components/switch.d.ts +16 -0
  175. package/components/switch.js +29 -0
  176. package/components/switch.js.map +1 -0
  177. package/components/table-toolbar.d.ts +55 -0
  178. package/components/table-toolbar.js +119 -0
  179. package/components/table-toolbar.js.map +1 -0
  180. package/components/table.d.ts +276 -0
  181. package/components/table.js +572 -0
  182. package/components/table.js.map +1 -0
  183. package/components/tabs.d.ts +36 -0
  184. package/components/tabs.js +120 -0
  185. package/components/tabs.js.map +1 -0
  186. package/components/text-link.d.ts +16 -0
  187. package/components/text-link.js +32 -0
  188. package/components/text-link.js.map +1 -0
  189. package/components/textarea.d.ts +10 -0
  190. package/components/textarea.js +23 -0
  191. package/components/textarea.js.map +1 -0
  192. package/components/theme.d.ts +28 -0
  193. package/components/theme.js +158 -0
  194. package/components/theme.js.map +1 -0
  195. package/components/time-series-chart.d.ts +122 -0
  196. package/components/time-series-chart.js +722 -0
  197. package/components/time-series-chart.js.map +1 -0
  198. package/components/toaster.d.ts +3 -0
  199. package/components/toaster.js +44 -0
  200. package/components/toaster.js.map +1 -0
  201. package/components/tooltip.d.ts +64 -0
  202. package/components/tooltip.js +126 -0
  203. package/components/tooltip.js.map +1 -0
  204. package/components/view-picker.d.ts +20 -0
  205. package/components/view-picker.js +24 -0
  206. package/components/view-picker.js.map +1 -0
  207. package/fonts/inter-OFL.txt +93 -0
  208. package/fonts/inter-cyrillic-ext.woff2 +0 -0
  209. package/fonts/inter-cyrillic.woff2 +0 -0
  210. package/fonts/inter-greek-ext.woff2 +0 -0
  211. package/fonts/inter-greek.woff2 +0 -0
  212. package/fonts/inter-latin-ext.woff2 +0 -0
  213. package/fonts/inter-latin.woff2 +0 -0
  214. package/fonts/inter-vietnamese.woff2 +0 -0
  215. package/fonts.css +83 -0
  216. package/lib/animation.d.ts +14 -0
  217. package/lib/animation.js +20 -0
  218. package/lib/animation.js.map +1 -0
  219. package/lib/aria.d.ts +5 -0
  220. package/lib/aria.js +12 -0
  221. package/lib/aria.js.map +1 -0
  222. package/lib/chart-curve.d.ts +13 -0
  223. package/lib/chart-curve.js +79 -0
  224. package/lib/chart-curve.js.map +1 -0
  225. package/lib/classes.d.ts +134 -0
  226. package/lib/classes.js +152 -0
  227. package/lib/classes.js.map +1 -0
  228. package/lib/color.d.ts +25 -0
  229. package/lib/color.js +149 -0
  230. package/lib/color.js.map +1 -0
  231. package/lib/data-table-state.d.ts +87 -0
  232. package/lib/data-table-state.js +92 -0
  233. package/lib/data-table-state.js.map +1 -0
  234. package/lib/day.d.ts +9 -0
  235. package/lib/day.js +20 -0
  236. package/lib/day.js.map +1 -0
  237. package/lib/design-tokens.d.ts +56 -0
  238. package/lib/design-tokens.js +196 -0
  239. package/lib/design-tokens.js.map +1 -0
  240. package/lib/icon.d.ts +17 -0
  241. package/lib/icon.js +34 -0
  242. package/lib/icon.js.map +1 -0
  243. package/lib/icons.d.ts +29 -0
  244. package/lib/icons.js +34 -0
  245. package/lib/icons.js.map +1 -0
  246. package/lib/interactive.d.ts +21 -0
  247. package/lib/interactive.js +31 -0
  248. package/lib/interactive.js.map +1 -0
  249. package/lib/load-more.d.ts +14 -0
  250. package/lib/load-more.js +27 -0
  251. package/lib/load-more.js.map +1 -0
  252. package/lib/media.d.ts +58 -0
  253. package/lib/media.js +116 -0
  254. package/lib/media.js.map +1 -0
  255. package/lib/segmented.d.ts +57 -0
  256. package/lib/segmented.js +83 -0
  257. package/lib/segmented.js.map +1 -0
  258. package/lib/shortcuts.d.ts +94 -0
  259. package/lib/shortcuts.js +271 -0
  260. package/lib/shortcuts.js.map +1 -0
  261. package/lib/slot.d.ts +9 -0
  262. package/lib/slot.js +18 -0
  263. package/lib/slot.js.map +1 -0
  264. package/lib/time-series.d.ts +100 -0
  265. package/lib/time-series.js +144 -0
  266. package/lib/time-series.js.map +1 -0
  267. package/lib/tone.d.ts +6 -0
  268. package/lib/tone.js +0 -0
  269. package/lib/variants.d.ts +12 -0
  270. package/lib/variants.js +14 -0
  271. package/lib/variants.js.map +1 -0
  272. package/package.json +122 -3
  273. package/styles.css +630 -0
  274. package/tokens.d.ts +104 -0
  275. package/tokens.js +108 -0
  276. package/tokens.js.map +1 -0
  277. package/publish.log +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../src/components/button.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { Children, isValidElement, type ReactNode } from \"react\"\nimport { LoadingIcon } from \"../lib/icons\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { slot } from \"../lib/slot\"\nimport { cn, variants, type VariantProps } from \"../lib/variants\"\n\n// The shared chrome without its edge or cursor, which the button gates on its own variants.\nconst buttonInteractiveClasses = interactiveVariants({ interactive: false })\n\nconst buttonVariants = variants({\n base: [\n buttonInteractiveClasses,\n // Lifted while hovered or focused, so its focus outline runs over a neighbour's edge in a\n // `ButtonGroup` or a toolbar.\n \"group/button inline-flex items-center justify-center font-medium text-start rounded-md hover:z-10 focus-visible:z-10\",\n \"text-control\",\n \"relative transition-[color,background-color,border-color,box-shadow,translate] duration-150 ease-out-expo\",\n ],\n\n variants: {\n variant: {\n // The open look holds while the button's menu or popover is open (Base UI sets the\n // trigger's `aria-expanded`), so the trigger reads as the thing that opened it. Not\n // `data-popup-open`: a tooltip sets that too, and a button would look open under its tooltip.\n // The same look on hover rides `interactive`, below.\n primary:\n \"bg-ink text-ink-inverse shadow-control aria-expanded:bg-ink/90 aria-expanded:shadow-none\",\n secondary:\n \"bg-surface text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink\",\n soft: \"bg-fill text-ink-secondary aria-expanded:bg-fill-strong aria-expanded:text-ink\",\n ghost: \"text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink\",\n },\n // What the action means, apart from how loud it is. Danger is for a loss: a primary danger\n // button confirms one, a secondary danger button starts one from a page.\n tone: {\n neutral: \"\",\n danger: \"\",\n },\n bordered: {\n true: \"border border-edge-strong shadow-control aria-expanded:ui-standalone:border-edge-solid aria-expanded:ui-standalone:shadow-none\",\n },\n // A fixed height and no vertical padding, so a button lines up with the inputs, pickers\n // and triggers beside it whatever it holds: the control scale in `styles.css`.\n size: {\n xs: \"h-6 px-2 gap-1 text-xs rounded\",\n sm: \"h-7 px-2 gap-1.5\",\n md: \"h-control px-3 gap-1.5\",\n lg: \"h-9 px-3.5 gap-2 text-sm rounded-lg\",\n },\n interactive: {\n // A press sets the button down: it loses its shadow and drops 1px, as a card does. A fixed\n // 1px, so a wide button moves as far as a small one, and a move rather than a scale, which\n // would re-rasterise the label on every frame. It goes down at twice the speed it comes\n // back. The `::after` strip stays over the row the button left, or a press on its top pixel\n // would release outside it and lose the click. A member of a `ButtonGroup` stays in line with\n // its shadow, since either would step it out of the group's outline. Rides `interactive`: a\n // disabled control does not answer.\n true: [\n \"not-disabled:not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed\",\n \"ui-pressed:duration-75 ui-pressed:ui-standalone:shadow-none ui-pressed:ui-standalone:translate-y-px\",\n \"ui-pressed:ui-standalone:after:absolute ui-pressed:ui-standalone:after:inset-x-0 ui-pressed:ui-standalone:after:-top-0.5 ui-pressed:ui-standalone:after:h-0.5\",\n ],\n },\n },\n\n compoundVariants: [\n // A disabled button fades its label and icons to half strength but keeps its fill and edge, so\n // a disabled member of a `ButtonGroup` still draws its part of the outline. On its own it also\n // goes flat. A pending button keeps its colour, since it is busy rather than unavailable.\n {\n variant: [\"secondary\", \"soft\", \"ghost\"],\n class: [\n \"not-data-pending:disabled:*:opacity-50 not-data-pending:disabled:ui-standalone:shadow-none\",\n \"aria-disabled:*:opacity-50 aria-disabled:ui-standalone:shadow-none\",\n ],\n },\n // A disabled primary button goes flat and grey instead: ink at half strength reads as a\n // dimmed slab, while the fill reads as a button that is not ready yet.\n {\n variant: \"primary\",\n class: [\n \"not-data-pending:disabled:bg-fill not-data-pending:disabled:text-ink-muted not-data-pending:disabled:shadow-none\",\n \"aria-disabled:bg-fill aria-disabled:text-ink-muted aria-disabled:shadow-none\",\n ],\n },\n // Only a button that does something answers the pointer. A reading drawn as a button, with\n // `interactive` off, keeps its resting look under the cursor. Each variant darkens one step\n // past its hover when pressed, which is the whole press of a `ButtonGroup` member.\n {\n variant: \"primary\",\n interactive: true,\n class: \"hover:not-disabled:not-aria-disabled:bg-ink/90 ui-pressed:bg-ink/80\",\n },\n {\n variant: [\"secondary\", \"ghost\"],\n interactive: true,\n class:\n \"hover:not-disabled:not-aria-disabled:bg-fill-subtle hover:not-disabled:not-aria-disabled:text-ink ui-pressed:bg-fill\",\n },\n // A bordered button's edge darkens under the pointer, as a field's and a checkbox's do. Not in\n // a `ButtonGroup`, where a member shares its left edge with the one before it, so a darker\n // edge would stop short on that side: a member answers with its fill alone.\n {\n bordered: true,\n interactive: true,\n class: \"hover:ui-standalone:not-disabled:not-aria-disabled:border-edge-solid\",\n },\n {\n variant: \"soft\",\n interactive: true,\n // The fill has no step past `fill-strong`, so a pressed soft button keeps its hover fill.\n class:\n \"hover:not-disabled:not-aria-disabled:bg-fill-strong hover:not-disabled:not-aria-disabled:text-ink ui-pressed:bg-fill-strong\",\n },\n {\n variant: \"primary\",\n tone: \"danger\",\n class:\n \"bg-danger text-danger-on hover:not-disabled:not-aria-disabled:bg-danger/90 aria-expanded:bg-danger/90\",\n },\n {\n variant: \"primary\",\n tone: \"danger\",\n interactive: true,\n class: \"ui-pressed:bg-danger/80\",\n },\n {\n variant: [\"secondary\", \"soft\", \"ghost\"],\n tone: \"danger\",\n class:\n \"text-danger-ink hover:not-disabled:not-aria-disabled:text-danger-ink aria-expanded:text-danger-ink\",\n },\n ],\n\n defaultVariants: {\n variant: \"primary\",\n tone: \"neutral\",\n size: \"md\",\n interactive: true,\n },\n})\n\n// A 14px icon, drawn 2px closer to the edge than the text is.\nconst buttonAffixClasses = \"shrink-0 first:-ml-0.5 last:-mr-0.5 [svg]:size-3.5\"\n// Nothing but an icon: a square of the button's height, the icon centred in it.\nconst buttonSquareClasses = \"px-0 aspect-square\"\nconst buttonSquareAffixClasses = \"shrink-0 [svg]:size-3.5\"\n\n/**\n * Hidden while a button with no leading icon is pending, so only the spinner reads as content. A\n * button with one keeps its label, since the spinner takes the icon's place.\n */\nconst buttonPendingClasses = \"group-data-pending/button:text-transparent\"\n\nexport type ButtonProps = Omit<useRender.ComponentProps<\"button\">, \"size\" | \"prefix\"> &\n VariantProps<typeof buttonVariants> & {\n /**\n * If set to `true`, the button will be rendered in the pending state.\n */\n isPending?: boolean\n\n /** The slot to be rendered before the label. */\n prefix?: ReactNode\n\n /** The slot to be rendered after the label. */\n suffix?: ReactNode\n }\n\nfunction Button({\n children,\n className,\n disabled = false,\n render,\n isPending,\n prefix,\n suffix,\n variant,\n tone,\n size,\n interactive = true,\n bordered,\n ...rest\n}: ButtonProps) {\n // `toArray` drops `false` and `null`, so a label hidden with `{wide && \"Label\"}` leaves an\n // icon-only button, square and with nothing beside its icon.\n const square = Children.toArray(children).length === 0\n const affixClasses = square ? buttonSquareAffixClasses : buttonAffixClasses\n const props = mergeProps<\"button\">(\n {\n disabled: disabled || isPending,\n \"aria-busy\": isPending ? true : undefined,\n className: buttonVariants({\n variant,\n tone,\n size,\n interactive,\n bordered: bordered ?? variant === \"secondary\",\n className: cn(square && buttonSquareClasses, className),\n }),\n children: (\n <>\n {slot(prefix && isPending ? <LoadingIcon className=\"animate-spin\" /> : prefix, {\n className: affixClasses,\n })}\n\n {/* Beside an affix the label fills the row and pushes the suffix to the end. Alone it\n keeps its own width, so the button's `justify-*` places it: centred by default,\n at the start for a `justify-start` row. */}\n {!square &&\n slot(isValidElement(children) ? children : <span>{children}</span>, {\n className: cn(\n \"flex-1 truncate only:flex-initial has-[div]:contents\",\n !prefix && buttonPendingClasses,\n ),\n })}\n\n {slot(suffix, { className: cn(affixClasses, buttonPendingClasses) })}\n\n {!prefix && !!isPending && (\n <LoadingIcon className=\"absolute size-[1.25em] animate-spin\" />\n )}\n </>\n ),\n },\n rest,\n )\n\n // `data-pending` drives the label and suffix fade; it sits outside `mergeProps`, whose\n // button props type has no room for a custom data attribute.\n //\n // `type` defaults to \"button\", not HTML's \"submit\": a Button inside a <form> that never\n // meant to submit it (a dialog's X, a search field's clear) otherwise does. Callers that\n // want a submit still say so: `props` spreads last and wins. Only applied when the\n // element really is a <button>, since `type` means something else on an <a> or a <label>.\n const isButton = !render\n\n return useRender({\n defaultTagName: \"button\",\n render,\n props: {\n \"data-pending\": isPending ? true : undefined,\n \"data-pressable\": interactive ? \"\" : undefined,\n ...(isButton && { type: \"button\" }),\n ...props,\n },\n })\n}\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;AASA,MAAM,2BAA2B,oBAAoB,EAAE,aAAa,MAAM,CAAC;AAE3E,MAAM,iBAAiB,SAAS;CAC9B,MAAM;EACJ;EAGA;EACA;EACA;CACF;CAEA,UAAU;EACR,SAAS;GAKP,SACE;GACF,WACE;GACF,MAAM;GACN,OAAO;EACT;EAGA,MAAM;GACJ,SAAS;GACT,QAAQ;EACV;EACA,UAAU,EACR,MAAM,iIACR;EAGA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,aAAa,EAQX,MAAM;GACJ;GACA;GACA;EACF,EACF;CACF;CAEA,kBAAkB;EAIhB;GACE,SAAS;IAAC;IAAa;IAAQ;GAAO;GACtC,OAAO,CACL,8FACA,oEACF;EACF;EAGA;GACE,SAAS;GACT,OAAO,CACL,oHACA,8EACF;EACF;EAIA;GACE,SAAS;GACT,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS,CAAC,aAAa,OAAO;GAC9B,aAAa;GACb,OACE;EACJ;EAIA;GACE,UAAU;GACV,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS;GACT,aAAa;GAEb,OACE;EACJ;EACA;GACE,SAAS;GACT,MAAM;GACN,OACE;EACJ;EACA;GACE,SAAS;GACT,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS;IAAC;IAAa;IAAQ;GAAO;GACtC,MAAM;GACN,OACE;EACJ;CACF;CAEA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,MAAM;EACN,aAAa;CACf;AACF,CAAC;AAGD,MAAM,qBAAqB;AAE3B,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;;;;;AAMjC,MAAM,uBAAuB;AAgB7B,SAAS,OAAO,EACd,UACA,WACA,WAAW,OACX,QACA,WACA,QACA,QACA,SACA,MACA,MACA,cAAc,MACd,UACA,GAAG,QACW;CAGd,MAAM,SAAS,SAAS,QAAQ,QAAQ,CAAC,CAAC,WAAW;CACrD,MAAM,eAAe,SAAS,2BAA2B;CACzD,MAAM,QAAQ,WACZ;EACE,UAAU,YAAY;EACtB,aAAa,YAAY,OAAO,KAAA;EAChC,WAAW,eAAe;GACxB;GACA;GACA;GACA;GACA,UAAU,YAAY,YAAY;GAClC,WAAW,GAAG,UAAU,qBAAqB,SAAS;EACxD,CAAC;EACD,UACE,qBAAA,UAAA,EAAA,UAAA;GACG,KAAK,UAAU,YAAY,oBAAC,aAAD,EAAa,WAAU,eAAgB,CAAA,IAAI,QAAQ,EAC7E,WAAW,aACb,CAAC;GAKA,CAAC,UACA,KAAK,eAAe,QAAQ,IAAI,WAAW,oBAAC,QAAD,EAAO,SAAe,CAAA,GAAG,EAClE,WAAW,GACT,wDACA,CAAC,UAAU,oBACb,EACF,CAAC;GAEF,KAAK,QAAQ,EAAE,WAAW,GAAG,cAAc,oBAAoB,EAAE,CAAC;GAElE,CAAC,UAAU,CAAC,CAAC,aACZ,oBAAC,aAAD,EAAa,WAAU,sCAAuC,CAAA;EAEhE,EAAA,CAAA;CAEN,GACA,IACF;CAWA,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,gBAAgB,YAAY,OAAO,KAAA;GACnC,kBAAkB,cAAc,KAAK,KAAA;GACrC,GAAI,CARU,UAQE,EAAE,MAAM,SAAS;GACjC,GAAG;EACL;CACF,CAAC;AACH"}
@@ -0,0 +1,27 @@
1
+ import { DateRange as CalendarRange, DayPickerProps } from "react-day-picker";
2
+ /**
3
+ * `ref` and `initialFocus` for the popover or dialog holding a `Calendar`: focus lands on the
4
+ * day react-day-picker marks as its keyboard entry point, so arrow keys move between days at
5
+ * once. Base UI otherwise focuses the back arrow, and react-day-picker's own `autoFocus` does
6
+ * not fire once Base UI has taken focus.
7
+ */
8
+ export declare function useCalendarFocus(): {
9
+ ref: import("react").RefObject<HTMLDivElement | null>;
10
+ initialFocus: () => HTMLElement | null;
11
+ };
12
+ export type CalendarProps = DayPickerProps & {
13
+ /**
14
+ * Spread the month across its container instead of sizing it to the day cells. For a single
15
+ * month filling a phone-width sheet, where a grid sized to 32px cells leaves a wide margin
16
+ * either side. Days grow with the columns, which also gives them a thumb-sized target.
17
+ */
18
+ fluid?: boolean;
19
+ };
20
+ /**
21
+ * A month grid: one date, several, or a range, depending on `mode`. Every react-day-picker prop
22
+ * passes through; this wraps it in the site's tokens and glyphs.
23
+ *
24
+ * Weeks start on Monday; pass `weekStartsOn` to change that.
25
+ */
26
+ export declare function Calendar({ className, classNames, fluid, ...props }: CalendarProps): import("react").JSX.Element;
27
+ export type { CalendarRange };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { ChevronLeftIcon, ChevronRightIcon } from "../lib/icons.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useEffect, useRef } from "react";
6
+ import { DayPicker } from "react-day-picker";
7
+ // src/components/calendar.tsx
8
+ /** The month back/forward arrow, on both the single and the two-month layout. */
9
+ const navButton = "row-start-1 inline-flex size-7 cursor-pointer items-center justify-center rounded-md text-ink-secondary hover:bg-fill-subtle hover:text-ink aria-disabled:opacity-40";
10
+ /**
11
+ * The month navigation arrows, drawn from this package's own glyph set rather than
12
+ * react-day-picker's inline SVG.
13
+ */
14
+ function Chevron({ orientation, className }) {
15
+ return /* @__PURE__ */ jsx(orientation === "left" ? ChevronLeftIcon : ChevronRightIcon, { className: cn("size-3.5", className) });
16
+ }
17
+ /**
18
+ * The day cell's button. Its fill is computed here, from the modifiers, instead of through the
19
+ * `classNames` map: a day in a selected range carries `selected` *and* `range_middle`, whose
20
+ * class strings would both land on the element with no defined order between them. Resolving
21
+ * it in JS lets `cn` drop the loser.
22
+ */
23
+ function DayButton({ day: _day, modifiers, className, ...props }) {
24
+ const ref = useRef(null);
25
+ useEffect(() => {
26
+ if (modifiers.focused) ref.current?.focus();
27
+ }, [modifiers.focused]);
28
+ const filled = modifiers.selected && !modifiers.range_middle && !modifiers.outside;
29
+ return /* @__PURE__ */ jsx("button", {
30
+ ref,
31
+ type: "button",
32
+ className: cn("relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-xs", "disabled:opacity-40", filled ? "bg-ink font-medium text-ink-inverse" : "text-ink-secondary hover:bg-fill-subtle hover:text-ink", modifiers.range_middle && "font-medium text-ink", modifiers.outside && !filled && "text-ink-muted", modifiers.today && "font-medium after:absolute after:bottom-1 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full after:bg-current", className),
33
+ ...props
34
+ });
35
+ }
36
+ /**
37
+ * `ref` and `initialFocus` for the popover or dialog holding a `Calendar`: focus lands on the
38
+ * day react-day-picker marks as its keyboard entry point, so arrow keys move between days at
39
+ * once. Base UI otherwise focuses the back arrow, and react-day-picker's own `autoFocus` does
40
+ * not fire once Base UI has taken focus.
41
+ */
42
+ function useCalendarFocus() {
43
+ const ref = useRef(null);
44
+ function initialFocus() {
45
+ return ref.current?.querySelector("[role=\"grid\"] button[tabindex=\"0\"]") ?? null;
46
+ }
47
+ return {
48
+ ref,
49
+ initialFocus
50
+ };
51
+ }
52
+ /**
53
+ * A month grid: one date, several, or a range, depending on `mode`. Every react-day-picker prop
54
+ * passes through; this wraps it in the site's tokens and glyphs.
55
+ *
56
+ * Weeks start on Monday; pass `weekStartsOn` to change that.
57
+ */
58
+ function Calendar({ className, classNames, fluid, ...props }) {
59
+ return /* @__PURE__ */ jsx(DayPicker, {
60
+ weekStartsOn: 1,
61
+ showOutsideDays: true,
62
+ fixedWeeks: true,
63
+ navLayout: "around",
64
+ className: cn("select-none", fluid ? "w-full" : "w-fit", className),
65
+ components: {
66
+ Chevron,
67
+ DayButton
68
+ },
69
+ classNames: {
70
+ months: "flex items-start gap-6 max-sm:flex-col max-sm:gap-4",
71
+ month: cn("grid grid-cols-[1.75rem_1fr_1.75rem] items-center gap-y-3", fluid && "w-full"),
72
+ button_previous: cn(navButton, "col-start-1"),
73
+ button_next: cn(navButton, "col-start-3"),
74
+ month_caption: "col-start-2 row-start-1 flex justify-center font-medium text-sm",
75
+ month_grid: cn("col-span-3 row-start-2 border-separate border-spacing-y-1", fluid && "w-full table-fixed"),
76
+ weekdays: "",
77
+ weekday: cn("pb-2 font-normal text-2xs text-ink-muted", !fluid && "w-8"),
78
+ week: "",
79
+ day: "p-0 text-center first:rounded-l-md last:rounded-r-md",
80
+ range_start: "rounded-l-md bg-fill",
81
+ range_middle: "bg-fill",
82
+ range_end: "rounded-r-md bg-fill",
83
+ selected: "",
84
+ today: "",
85
+ outside: "",
86
+ disabled: "",
87
+ day_button: fluid ? "h-10 w-full" : "",
88
+ ...classNames
89
+ },
90
+ ...props
91
+ });
92
+ }
93
+ export { Calendar, useCalendarFocus };
94
+
95
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.js","names":[],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport { useEffect, useRef } from \"react\"\nimport {\n DayPicker,\n type ChevronProps,\n type DayButtonProps,\n type DayPickerProps,\n} from \"react-day-picker\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../lib/icons\"\nimport { cn } from \"../lib/variants\"\n\n/** The month back/forward arrow, on both the single and the two-month layout. */\nconst navButton =\n \"row-start-1 inline-flex size-7 cursor-pointer items-center justify-center rounded-md text-ink-secondary hover:bg-fill-subtle hover:text-ink aria-disabled:opacity-40\"\n\n/**\n * The month navigation arrows, drawn from this package's own glyph set rather than\n * react-day-picker's inline SVG.\n */\nfunction Chevron({ orientation, className }: ChevronProps) {\n const Icon = orientation === \"left\" ? ChevronLeftIcon : ChevronRightIcon\n return <Icon className={cn(\"size-3.5\", className)} />\n}\n\n/**\n * The day cell's button. Its fill is computed here, from the modifiers, instead of through the\n * `classNames` map: a day in a selected range carries `selected` *and* `range_middle`, whose\n * class strings would both land on the element with no defined order between them. Resolving\n * it in JS lets `cn` drop the loser.\n */\nfunction DayButton({ day: _day, modifiers, className, ...props }: DayButtonProps) {\n // react-day-picker moves a `focused` flag between days as the arrow keys walk the grid, and\n // expects the day wearing it to pull the browser's focus across. Its own DayButton does this;\n // an override that leaves it out renders a grid the arrow keys appear to ignore.\n const ref = useRef<HTMLButtonElement>(null)\n useEffect(() => {\n if (modifiers.focused) ref.current?.focus()\n }, [modifiers.focused])\n\n // The ends of a range read as picked; the days between them are only tinted, so the two\n // dates a reader is looking for stay legible inside the band. An outside day never takes the\n // solid chip: six fixed week rows mean a neighbouring month's days can appear in two grids at\n // once, and only the one in its own month should read as the day that was picked.\n const filled = modifiers.selected && !modifiers.range_middle && !modifiers.outside\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n // `h-8 w-8` rather than `size-8`: `fluid` overrides the width alone, and class merging\n // drops a whole `size-*` when a later `w-*` lands on it, taking the height with it.\n \"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-xs\",\n \"disabled:opacity-40\",\n filled\n ? \"bg-ink font-medium text-ink-inverse\"\n : \"text-ink-secondary hover:bg-fill-subtle hover:text-ink\",\n // Every day of a range is set in medium, so the span reads as one block at a glance.\n modifiers.range_middle && \"font-medium text-ink\",\n // A neighbouring month's day is still a day that can be picked, so it is muted rather\n // than dimmed out of reach.\n modifiers.outside && !filled && \"text-ink-muted\",\n // A dot under the number, in whatever colour the number itself is.\n modifiers.today &&\n \"font-medium after:absolute after:bottom-1 after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full after:bg-current\",\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * `ref` and `initialFocus` for the popover or dialog holding a `Calendar`: focus lands on the\n * day react-day-picker marks as its keyboard entry point, so arrow keys move between days at\n * once. Base UI otherwise focuses the back arrow, and react-day-picker's own `autoFocus` does\n * not fire once Base UI has taken focus.\n */\nexport function useCalendarFocus() {\n const ref = useRef<HTMLDivElement>(null)\n\n function initialFocus() {\n return ref.current?.querySelector<HTMLElement>('[role=\"grid\"] button[tabindex=\"0\"]') ?? null\n }\n\n return { ref, initialFocus }\n}\n\nexport type CalendarProps = DayPickerProps & {\n /**\n * Spread the month across its container instead of sizing it to the day cells. For a single\n * month filling a phone-width sheet, where a grid sized to 32px cells leaves a wide margin\n * either side. Days grow with the columns, which also gives them a thumb-sized target.\n */\n fluid?: boolean\n}\n\n/**\n * A month grid: one date, several, or a range, depending on `mode`. Every react-day-picker prop\n * passes through; this wraps it in the site's tokens and glyphs.\n *\n * Weeks start on Monday; pass `weekStartsOn` to change that.\n */\nexport function Calendar({ className, classNames, fluid, ...props }: CalendarProps) {\n return (\n <DayPicker\n weekStartsOn={1}\n showOutsideDays\n // Always six week rows, so the panel keeps its height from one month to the next instead\n // of resizing under the cursor, and side-by-side months line up row for row.\n fixedWeeks\n // Both arrows sit on the caption row of the months they belong to, so a two-month\n // calendar keeps one arrow at each outer edge.\n navLayout=\"around\"\n className={cn(\"select-none\", fluid ? \"w-full\" : \"w-fit\", className)}\n components={{ Chevron, DayButton }}\n classNames={{\n months: \"flex items-start gap-6 max-sm:flex-col max-sm:gap-4\",\n // Three columns: the back arrow, the caption, the forward arrow. The grid spans all\n // three, and each part names its own column so a month missing an arrow keeps its\n // caption centred.\n month: cn(\"grid grid-cols-[1.75rem_1fr_1.75rem] items-center gap-y-3\", fluid && \"w-full\"),\n button_previous: cn(navButton, \"col-start-1\"),\n button_next: cn(navButton, \"col-start-3\"),\n month_caption: \"col-start-2 row-start-1 flex justify-center font-medium text-sm\",\n // Separate borders with vertical spacing only: the days of a week stay edge to edge so\n // a selected range reads as one unbroken bar, while the rows get air between them.\n // `table-fixed` is what splits the width into seven equal columns once it is `w-full`.\n month_grid: cn(\n \"col-span-3 row-start-2 border-separate border-spacing-y-1\",\n fluid && \"w-full table-fixed\",\n ),\n weekdays: \"\",\n weekday: cn(\"pb-2 font-normal text-2xs text-ink-muted\", !fluid && \"w-8\"),\n week: \"\",\n // The row's outer cells round the band where a range wraps onto the next week.\n day: \"p-0 text-center first:rounded-l-md last:rounded-r-md\",\n // The band behind a selected range. `range_start`/`range_end` round its outer edge; a\n // one-day range picks up both and rounds on both sides.\n range_start: \"rounded-l-md bg-fill\",\n range_middle: \"bg-fill\",\n range_end: \"rounded-r-md bg-fill\",\n // Left blank on purpose: `DayButton` draws these states from the modifiers instead,\n // where conflicting ones can be resolved in order.\n selected: \"\",\n today: \"\",\n outside: \"\",\n disabled: \"\",\n day_button: fluid ? \"h-10 w-full\" : \"\",\n ...classNames,\n }}\n {...props}\n />\n )\n}\n\n/** A `from`/`to` pair in `mode=\"range\"`, under a name that doesn't collide with a product's own. */\nexport type { DateRange as CalendarRange } from \"react-day-picker\"\n"],"mappings":";;;;;;;;AAaA,MAAM,YACJ;;;;;AAMF,SAAS,QAAQ,EAAE,aAAa,aAA2B;CAEzD,OAAO,oBADM,gBAAgB,SAAS,kBAAkB,kBACjD,EAAM,WAAW,GAAG,YAAY,SAAS,EAAI,CAAA;AACtD;;;;;;;AAQA,SAAS,UAAU,EAAE,KAAK,MAAM,WAAW,WAAW,GAAG,SAAyB;CAIhF,MAAM,MAAM,OAA0B,IAAI;CAC1C,gBAAgB;EACd,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM;CAC5C,GAAG,CAAC,UAAU,OAAO,CAAC;CAMtB,MAAM,SAAS,UAAU,YAAY,CAAC,UAAU,gBAAgB,CAAC,UAAU;CAE3E,OACE,oBAAC,UAAD;EACO;EACL,MAAK;EACL,WAAW,GAGT,uFACA,uBACA,SACI,wCACA,0DAEJ,UAAU,gBAAgB,wBAG1B,UAAU,WAAW,CAAC,UAAU,kBAEhC,UAAU,SACR,oIACF,SACF;EACA,GAAI;CACL,CAAA;AAEL;;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,MAAM,OAAuB,IAAI;CAEvC,SAAS,eAAe;EACtB,OAAO,IAAI,SAAS,cAA2B,wCAAoC,KAAK;CAC1F;CAEA,OAAO;EAAE;EAAK;CAAa;AAC7B;;;;;;;AAiBA,SAAgB,SAAS,EAAE,WAAW,YAAY,OAAO,GAAG,SAAwB;CAClF,OACE,oBAAC,WAAD;EACE,cAAc;EACd,iBAAA;EAGA,YAAA;EAGA,WAAU;EACV,WAAW,GAAG,eAAe,QAAQ,WAAW,SAAS,SAAS;EAClE,YAAY;GAAE;GAAS;EAAU;EACjC,YAAY;GACV,QAAQ;GAIR,OAAO,GAAG,6DAA6D,SAAS,QAAQ;GACxF,iBAAiB,GAAG,WAAW,aAAa;GAC5C,aAAa,GAAG,WAAW,aAAa;GACxC,eAAe;GAIf,YAAY,GACV,6DACA,SAAS,oBACX;GACA,UAAU;GACV,SAAS,GAAG,4CAA4C,CAAC,SAAS,KAAK;GACvE,MAAM;GAEN,KAAK;GAGL,aAAa;GACb,cAAc;GACd,WAAW;GAGX,UAAU;GACV,OAAO;GACP,SAAS;GACT,UAAU;GACV,YAAY,QAAQ,gBAAgB;GACpC,GAAG;EACL;EACA,GAAI;CACL,CAAA;AAEL"}
@@ -0,0 +1,26 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { Stack } from "./stack.js";
3
+ import { ComponentProps, ReactNode } from "react";
4
+ declare const calloutVariants: import("tailwind-variants").TVReturnType<{
5
+ tone: {
6
+ neutral: string;
7
+ warning: string;
8
+ success: string;
9
+ danger: string;
10
+ };
11
+ }, undefined, "w-full gap-x-2.5 rounded-lg px-3.5 py-3 text-ink", undefined, undefined, undefined>;
12
+ type CalloutProps = Omit<ComponentProps<typeof Stack>, "prefix" | "suffix"> & VariantProps<typeof calloutVariants> & {
13
+ /** The slot to be rendered before the content. Defaults to the tone's own icon. */
14
+ prefix?: ReactNode;
15
+ /** The slot to be rendered after the content, such as a single trailing link. */
16
+ suffix?: ReactNode;
17
+ /**
18
+ * Announces the callout when it appears, for one shown in answer to an action: `assertive`
19
+ * for a failure, `polite` for a confirmation. Leave it off for a callout that renders with
20
+ * the page.
21
+ */
22
+ live?: "polite" | "assertive";
23
+ };
24
+ declare function Callout({ children, className, tone, prefix, suffix, live, ...props }: CalloutProps): import("react").JSX.Element;
25
+ declare function CalloutText({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
26
+ export { Callout, CalloutText };
@@ -0,0 +1,71 @@
1
+ import { AlertCircleIcon, AlertIcon, CheckCircleIcon, InfoIcon } from "../lib/icons.js";
2
+ import { slot } from "../lib/slot.js";
3
+ import { cn, variants } from "../lib/variants.js";
4
+ import { Stack } from "./stack.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/callout.tsx
7
+ const calloutVariants = variants({
8
+ base: "w-full gap-x-2.5 rounded-lg px-3.5 py-3 text-ink",
9
+ variants: { tone: {
10
+ neutral: "border bg-fill",
11
+ warning: "border border-warning-edge bg-warning-subtle",
12
+ success: "border border-success-edge bg-success-subtle",
13
+ danger: "border border-danger-edge bg-danger-subtle"
14
+ } },
15
+ defaultVariants: { tone: "neutral" }
16
+ });
17
+ /** The icon carries the tone on its own, so the words beside it stay in the page's ink. */
18
+ const calloutIconVariants = variants({
19
+ base: "mt-0.5 size-4 shrink-0 self-start",
20
+ variants: { tone: {
21
+ neutral: "text-ink-muted",
22
+ warning: "text-warning-ink",
23
+ success: "text-success-ink",
24
+ danger: "text-danger-ink"
25
+ } },
26
+ defaultVariants: { tone: "neutral" }
27
+ });
28
+ /**
29
+ * The role for each way a callout is announced. A callout on screen from the start is a note
30
+ * whatever its tone: a live role there would interrupt a screen reader on page load and read the
31
+ * callout twice. Only a callout that appears in answer to an action is live.
32
+ */
33
+ const calloutRoles = {
34
+ off: "note",
35
+ polite: "status",
36
+ assertive: "alert"
37
+ };
38
+ /** The outline icon for each tone, from the same set as every other icon in the interface. */
39
+ const calloutIcons = {
40
+ neutral: InfoIcon,
41
+ warning: AlertIcon,
42
+ success: CheckCircleIcon,
43
+ danger: AlertCircleIcon
44
+ };
45
+ function Callout({ children, className, tone, prefix, suffix, live, ...props }) {
46
+ const ToneIcon = calloutIcons[tone ?? "neutral"];
47
+ return /* @__PURE__ */ jsxs(Stack, {
48
+ size: "sm",
49
+ wrap: false,
50
+ role: calloutRoles[live ?? "off"],
51
+ className: calloutVariants({
52
+ tone,
53
+ className
54
+ }),
55
+ ...props,
56
+ children: [
57
+ slot(prefix ?? /* @__PURE__ */ jsx(ToneIcon, {}), { className: calloutIconVariants({ tone }) }),
58
+ children,
59
+ slot(suffix, { className: "shrink-0 self-center" })
60
+ ]
61
+ });
62
+ }
63
+ function CalloutText({ className, ...props }) {
64
+ return /* @__PURE__ */ jsx("p", {
65
+ className: cn("text-copy font-medium", className),
66
+ ...props
67
+ });
68
+ }
69
+ export { Callout, CalloutText };
70
+
71
+ //# sourceMappingURL=callout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callout.js","names":[],"sources":["../../src/components/callout.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\"\nimport type { IconComponent } from \"../lib/icon\"\nimport { AlertCircleIcon, AlertIcon, CheckCircleIcon, InfoIcon } from \"../lib/icons\"\nimport { slot } from \"../lib/slot\"\nimport type { Tone } from \"../lib/tone\"\nimport { cn, variants, type VariantProps } from \"../lib/variants\"\nimport { Stack } from \"./stack\"\n\nconst calloutVariants = variants({\n // The edge is in the tone at 20%, the same edge an outline badge draws.\n base: \"w-full gap-x-2.5 rounded-lg px-3.5 py-3 text-ink\",\n\n variants: {\n tone: {\n neutral: \"border bg-fill\",\n warning: \"border border-warning-edge bg-warning-subtle\",\n success: \"border border-success-edge bg-success-subtle\",\n danger: \"border border-danger-edge bg-danger-subtle\",\n },\n },\n\n defaultVariants: {\n tone: \"neutral\",\n },\n})\n\n/** The icon carries the tone on its own, so the words beside it stay in the page's ink. */\nconst calloutIconVariants = variants({\n base: \"mt-0.5 size-4 shrink-0 self-start\",\n\n variants: {\n tone: {\n neutral: \"text-ink-muted\",\n warning: \"text-warning-ink\",\n success: \"text-success-ink\",\n danger: \"text-danger-ink\",\n },\n },\n\n defaultVariants: {\n tone: \"neutral\",\n },\n})\n\n/**\n * The role for each way a callout is announced. A callout on screen from the start is a note\n * whatever its tone: a live role there would interrupt a screen reader on page load and read the\n * callout twice. Only a callout that appears in answer to an action is live.\n */\nconst calloutRoles = {\n off: \"note\",\n polite: \"status\",\n assertive: \"alert\",\n} as const\n\n/** The outline icon for each tone, from the same set as every other icon in the interface. */\nconst calloutIcons: Record<Tone, IconComponent> = {\n neutral: InfoIcon,\n warning: AlertIcon,\n success: CheckCircleIcon,\n danger: AlertCircleIcon,\n}\n\ntype CalloutProps = Omit<ComponentProps<typeof Stack>, \"prefix\" | \"suffix\"> &\n VariantProps<typeof calloutVariants> & {\n /** The slot to be rendered before the content. Defaults to the tone's own icon. */\n prefix?: ReactNode\n\n /** The slot to be rendered after the content, such as a single trailing link. */\n suffix?: ReactNode\n\n /**\n * Announces the callout when it appears, for one shown in answer to an action: `assertive`\n * for a failure, `polite` for a confirmation. Leave it off for a callout that renders with\n * the page.\n */\n live?: \"polite\" | \"assertive\"\n }\n\nfunction Callout({ children, className, tone, prefix, suffix, live, ...props }: CalloutProps) {\n const ToneIcon = calloutIcons[tone ?? \"neutral\"]\n\n return (\n <Stack\n size=\"sm\"\n wrap={false}\n role={calloutRoles[live ?? \"off\"]}\n className={calloutVariants({ tone, className })}\n {...props}\n >\n {slot(prefix ?? <ToneIcon />, { className: calloutIconVariants({ tone }) })}\n {children}\n {slot(suffix, { className: \"shrink-0 self-center\" })}\n </Stack>\n )\n}\n\nfunction CalloutText({ className, ...props }: ComponentProps<\"p\">) {\n return <p className={cn(\"text-copy font-medium\", className)} {...props} />\n}\n\nexport { Callout, CalloutText }\n"],"mappings":";;;;;;AAQA,MAAM,kBAAkB,SAAS;CAE/B,MAAM;CAEN,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;CACV,EACF;CAEA,iBAAiB,EACf,MAAM,UACR;AACF,CAAC;;AAGD,MAAM,sBAAsB,SAAS;CACnC,MAAM;CAEN,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;CACV,EACF;CAEA,iBAAiB,EACf,MAAM,UACR;AACF,CAAC;;;;;;AAOD,MAAM,eAAe;CACnB,KAAK;CACL,QAAQ;CACR,WAAW;AACb;;AAGA,MAAM,eAA4C;CAChD,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;AACV;AAkBA,SAAS,QAAQ,EAAE,UAAU,WAAW,MAAM,QAAQ,QAAQ,MAAM,GAAG,SAAuB;CAC5F,MAAM,WAAW,aAAa,QAAQ;CAEtC,OACE,qBAAC,OAAD;EACE,MAAK;EACL,MAAM;EACN,MAAM,aAAa,QAAQ;EAC3B,WAAW,gBAAgB;GAAE;GAAM;EAAU,CAAC;EAC9C,GAAI;EALN,UAAA;GAOG,KAAK,UAAU,oBAAC,UAAD,CAAW,CAAA,GAAG,EAAE,WAAW,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;GACzE;GACA,KAAK,QAAQ,EAAE,WAAW,uBAAuB,CAAC;EAC9C;;AAEX;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA8B;CACjE,OAAO,oBAAC,KAAD;EAAG,WAAW,GAAG,yBAAyB,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC3E"}
@@ -0,0 +1,55 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { SectionHeader } from "./section-header.js";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { ComponentProps } from "react";
5
+ /**
6
+ * The one raised surface in the app: a white panel on the canvas, `lg` corners, clipping whatever
7
+ * sits in its corners, with a 1px border and `shadow-card` under it. A card that links somewhere
8
+ * lifts to `shadow-card-hover` under the pointer and sinks onto the page under a press. Every
9
+ * card, list card and stat strip is this recipe; change it here and it changes everywhere.
10
+ */
11
+ export declare const cardSurfaceClasses = "overflow-clip rounded-lg border bg-surface shadow-card";
12
+ /**
13
+ * A card with one link across it, pressed: it drops 1px and loses its shadow. The link carries
14
+ * `data-press-target`, so a press on a button inside the card leaves the card alone. A fixed 1px
15
+ * rather than a scale, since a card's text would re-rasterise in a scale. While held, the link's
16
+ * target reaches past the card's top edge, or a press on its first row would release off the link
17
+ * and lose the click. The card stops clipping for that moment, or the target would be cut off.
18
+ */
19
+ export declare const cardPressClasses = "transition-[box-shadow,translate] duration-150 ease-out-expo has-[[data-press-target]:active]:translate-y-px has-[[data-press-target]:active]:shadow-none has-[[data-press-target]:active]:duration-75 has-[[data-press-target]:active]:overflow-visible has-[[data-press-target]:active]:[&_[data-press-target]]:after:-top-0.5";
20
+ declare const cardVariants: import("tailwind-variants").TVReturnType<{
21
+ /**
22
+ * Separate the children with hairlines, for a card whose body is a run of rows or panels.
23
+ */
24
+ divided: {
25
+ true: string;
26
+ };
27
+ }, undefined, string[], undefined, undefined, undefined>;
28
+ declare const cardPanelVariants: import("tailwind-variants").TVReturnType<{
29
+ size: {
30
+ /** No padding of its own, for a panel that sets an inset per side. */
31
+ none: string;
32
+ md: string;
33
+ lg: string;
34
+ };
35
+ }, undefined, "border-t first:border-t-0", undefined, undefined, undefined>;
36
+ /**
37
+ * The card heading: `SectionHeader` preset to the card scale (an `h4` title, tight spacing). Pass
38
+ * `size="panel"` for the smaller dashboard-panel scale.
39
+ */
40
+ declare function CardHeader(props: ComponentProps<typeof SectionHeader>): import("react").JSX.Element;
41
+ export type CardProps = useRender.ComponentProps<"div"> & VariantProps<typeof cardVariants>;
42
+ declare function Card({ render, className, divided, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
43
+ /**
44
+ * The action band under a card's body: hairline above, the canvas colour rather than the
45
+ * card's, and the buttons right-aligned with the secondary before the primary. Every card
46
+ * that carries the actions for its own body wears it, so the controls never float loose
47
+ * under the surface they belong to. Content before the buttons takes `mr-auto` to stay left.
48
+ *
49
+ * The band sets the control type scale, which the buttons in it already carry: it is there so
50
+ * an `InlineAction`, which takes its size from the strip around it, lines up with them.
51
+ */
52
+ declare function CardFooter({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
53
+ export type CardPanelProps = useRender.ComponentProps<"div"> & VariantProps<typeof cardPanelVariants>;
54
+ declare function CardPanel({ className, render, size, ...props }: CardPanelProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
55
+ export { Card, CardFooter, CardHeader, CardPanel };
@@ -0,0 +1,96 @@
1
+ import { cn, variants } from "../lib/variants.js";
2
+ import { SectionHeader } from "./section-header.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ // src/components/card.tsx
6
+ /**
7
+ * The one raised surface in the app: a white panel on the canvas, `lg` corners, clipping whatever
8
+ * sits in its corners, with a 1px border and `shadow-card` under it. A card that links somewhere
9
+ * lifts to `shadow-card-hover` under the pointer and sinks onto the page under a press. Every
10
+ * card, list card and stat strip is this recipe; change it here and it changes everywhere.
11
+ */
12
+ const cardSurfaceClasses = "overflow-clip rounded-lg border bg-surface shadow-card";
13
+ /**
14
+ * A card with one link across it, pressed: it drops 1px and loses its shadow. The link carries
15
+ * `data-press-target`, so a press on a button inside the card leaves the card alone. A fixed 1px
16
+ * rather than a scale, since a card's text would re-rasterise in a scale. While held, the link's
17
+ * target reaches past the card's top edge, or a press on its first row would release off the link
18
+ * and lose the click. The card stops clipping for that moment, or the target would be cut off.
19
+ */
20
+ const cardPressClasses = "transition-[box-shadow,translate] duration-150 ease-out-expo has-[[data-press-target]:active]:translate-y-px has-[[data-press-target]:active]:shadow-none has-[[data-press-target]:active]:duration-75 has-[[data-press-target]:active]:overflow-visible has-[[data-press-target]:active]:[&_[data-press-target]]:after:-top-0.5";
21
+ const cardVariants = variants({
22
+ base: [cardSurfaceClasses, "relative flex flex-col transition-[box-shadow,translate] duration-150 ease-out-expo hover:[&[href]]:z-10 hover:[&[href]]:shadow-card-hover active:[&[href]]:translate-y-px active:[&[href]]:shadow-none active:[&[href]]:duration-75"],
23
+ variants: {
24
+ /**
25
+ * Separate the children with hairlines, for a card whose body is a run of rows or panels.
26
+ */
27
+ divided: { true: "divide-y" } }
28
+ });
29
+ const cardPanelVariants = variants({
30
+ base: "border-t first:border-t-0",
31
+ variants: { size: {
32
+ /** No padding of its own, for a panel that sets an inset per side. */
33
+ none: "",
34
+ md: "p-4 md:p-5",
35
+ lg: "p-6 md:p-8"
36
+ } },
37
+ defaultVariants: { size: "md" }
38
+ });
39
+ /**
40
+ * The card heading: `SectionHeader` preset to the card scale (an `h4` title, tight spacing). Pass
41
+ * `size="panel"` for the smaller dashboard-panel scale.
42
+ */
43
+ function CardHeader(props) {
44
+ return /* @__PURE__ */ jsx(SectionHeader, {
45
+ size: "card",
46
+ ...props
47
+ });
48
+ }
49
+ function Card({ render, className, divided, ...props }) {
50
+ return useRender({
51
+ render,
52
+ defaultTagName: "div",
53
+ props: {
54
+ className: cardVariants({
55
+ divided,
56
+ className
57
+ }),
58
+ ...props
59
+ }
60
+ });
61
+ }
62
+ /**
63
+ * The action band under a card's body: hairline above, the canvas colour rather than the
64
+ * card's, and the buttons right-aligned with the secondary before the primary. Every card
65
+ * that carries the actions for its own body wears it, so the controls never float loose
66
+ * under the surface they belong to. Content before the buttons takes `mr-auto` to stay left.
67
+ *
68
+ * The band sets the control type scale, which the buttons in it already carry: it is there so
69
+ * an `InlineAction`, which takes its size from the strip around it, lines up with them.
70
+ */
71
+ function CardFooter({ className, render, ...props }) {
72
+ return useRender({
73
+ render,
74
+ defaultTagName: "div",
75
+ props: {
76
+ className: cn("flex flex-wrap items-center justify-end gap-2 border-t bg-canvas p-4 md:px-5", "text-control", className),
77
+ ...props
78
+ }
79
+ });
80
+ }
81
+ function CardPanel({ className, render, size, ...props }) {
82
+ return useRender({
83
+ render,
84
+ defaultTagName: "div",
85
+ props: {
86
+ className: cardPanelVariants({
87
+ size,
88
+ className
89
+ }),
90
+ ...props
91
+ }
92
+ });
93
+ }
94
+ export { Card, CardFooter, CardHeader, CardPanel, cardPressClasses, cardSurfaceClasses };
95
+
96
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.js","names":[],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\"\nimport type { ComponentProps } from \"react\"\nimport { cn, variants, type VariantProps } from \"../lib/variants\"\nimport { SectionHeader } from \"./section-header\"\n\n/**\n * The one raised surface in the app: a white panel on the canvas, `lg` corners, clipping whatever\n * sits in its corners, with a 1px border and `shadow-card` under it. A card that links somewhere\n * lifts to `shadow-card-hover` under the pointer and sinks onto the page under a press. Every\n * card, list card and stat strip is this recipe; change it here and it changes everywhere.\n */\nexport const cardSurfaceClasses = \"overflow-clip rounded-lg border bg-surface shadow-card\"\n\n/**\n * A card with one link across it, pressed: it drops 1px and loses its shadow. The link carries\n * `data-press-target`, so a press on a button inside the card leaves the card alone. A fixed 1px\n * rather than a scale, since a card's text would re-rasterise in a scale. While held, the link's\n * target reaches past the card's top edge, or a press on its first row would release off the link\n * and lose the click. The card stops clipping for that moment, or the target would be cut off.\n */\nexport const cardPressClasses =\n \"transition-[box-shadow,translate] duration-150 ease-out-expo has-[[data-press-target]:active]:translate-y-px has-[[data-press-target]:active]:shadow-none has-[[data-press-target]:active]:duration-75 has-[[data-press-target]:active]:overflow-visible has-[[data-press-target]:active]:[&_[data-press-target]]:after:-top-0.5\"\n\nconst cardVariants = variants({\n base: [\n cardSurfaceClasses,\n \"relative flex flex-col transition-[box-shadow,translate] duration-150 ease-out-expo hover:[&[href]]:z-10 hover:[&[href]]:shadow-card-hover active:[&[href]]:translate-y-px active:[&[href]]:shadow-none active:[&[href]]:duration-75\",\n ],\n\n variants: {\n /**\n * Separate the children with hairlines, for a card whose body is a run of rows or panels.\n */\n divided: {\n true: \"divide-y\",\n },\n },\n})\n\nconst cardPanelVariants = variants({\n base: \"border-t first:border-t-0\",\n\n variants: {\n size: {\n /** No padding of its own, for a panel that sets an inset per side. */\n none: \"\",\n md: \"p-4 md:p-5\",\n lg: \"p-6 md:p-8\",\n },\n },\n\n defaultVariants: {\n size: \"md\",\n },\n})\n\n/**\n * The card heading: `SectionHeader` preset to the card scale (an `h4` title, tight spacing). Pass\n * `size=\"panel\"` for the smaller dashboard-panel scale.\n */\nfunction CardHeader(props: ComponentProps<typeof SectionHeader>) {\n return <SectionHeader size=\"card\" {...props} />\n}\n\nexport type CardProps = useRender.ComponentProps<\"div\"> & VariantProps<typeof cardVariants>\n\nfunction Card({ render, className, divided, ...props }: CardProps) {\n return useRender({\n render,\n defaultTagName: \"div\",\n props: { className: cardVariants({ divided, className }), ...props },\n })\n}\n\n/**\n * The action band under a card's body: hairline above, the canvas colour rather than the\n * card's, and the buttons right-aligned with the secondary before the primary. Every card\n * that carries the actions for its own body wears it, so the controls never float loose\n * under the surface they belong to. Content before the buttons takes `mr-auto` to stay left.\n *\n * The band sets the control type scale, which the buttons in it already carry: it is there so\n * an `InlineAction`, which takes its size from the strip around it, lines up with them.\n */\nfunction CardFooter({ className, render, ...props }: useRender.ComponentProps<\"div\">) {\n return useRender({\n render,\n defaultTagName: \"div\",\n props: {\n className: cn(\n \"flex flex-wrap items-center justify-end gap-2 border-t bg-canvas p-4 md:px-5\",\n \"text-control\",\n className,\n ),\n ...props,\n },\n })\n}\n\nexport type CardPanelProps = useRender.ComponentProps<\"div\"> &\n VariantProps<typeof cardPanelVariants>\n\nfunction CardPanel({ className, render, size, ...props }: CardPanelProps) {\n return useRender({\n render,\n defaultTagName: \"div\",\n props: {\n className: cardPanelVariants({ size, className }),\n ...props,\n },\n })\n}\n\nexport { Card, CardFooter, CardHeader, CardPanel }\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,qBAAqB;;;;;;;;AASlC,MAAa,mBACX;AAEF,MAAM,eAAe,SAAS;CAC5B,MAAM,CACJ,oBACA,sOACF;CAEA,UAAU;;;;AAIR,SAAS,EACP,MAAM,WACR,EACF;AACF,CAAC;AAED,MAAM,oBAAoB,SAAS;CACjC,MAAM;CAEN,UAAU,EACR,MAAM;;EAEJ,MAAM;EACN,IAAI;EACJ,IAAI;CACN,EACF;CAEA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC;;;;;AAMD,SAAS,WAAW,OAA6C;CAC/D,OAAO,oBAAC,eAAD;EAAe,MAAK;EAAO,GAAI;CAAQ,CAAA;AAChD;AAIA,SAAS,KAAK,EAAE,QAAQ,WAAW,SAAS,GAAG,SAAoB;CACjE,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GAAE,WAAW,aAAa;IAAE;IAAS;GAAU,CAAC;GAAG,GAAG;EAAM;CACrE,CAAC;AACH;;;;;;;;;;AAWA,SAAS,WAAW,EAAE,WAAW,QAAQ,GAAG,SAA0C;CACpF,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GACL,WAAW,GACT,gFACA,gBACA,SACF;GACA,GAAG;EACL;CACF,CAAC;AACH;AAKA,SAAS,UAAU,EAAE,WAAW,QAAQ,MAAM,GAAG,SAAyB;CACxE,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GACL,WAAW,kBAAkB;IAAE;IAAM;GAAU,CAAC;GAChD,GAAG;EACL;CACF,CAAC;AACH"}
@@ -0,0 +1,32 @@
1
+ import { TooltipFigure } from "./tooltip.js";
2
+ import { ReactNode } from "react";
3
+ /** A series' swatch: a solid square, or a dashed outline for a compared period. */
4
+ export type ChartIndicator = "dot" | "outline";
5
+ /** One series' row in a chart tooltip: its swatch, its name and its figure, already formatted. */
6
+ export interface ChartTooltipItem {
7
+ key: string;
8
+ label: ReactNode;
9
+ value: ReactNode;
10
+ color: string;
11
+ indicator?: ChartIndicator;
12
+ }
13
+ interface ChartTooltipContentProps {
14
+ title?: ReactNode;
15
+ items: ChartTooltipItem[];
16
+ /**
17
+ * More figures of the same point that no series draws (a bucket's sessions beside its
18
+ * visitors), under a hairline so they read as context rather than as a series.
19
+ */
20
+ details?: TooltipFigure[];
21
+ /**
22
+ * Extra content under the figures, on its own hairline-separated row (a point's notes).
23
+ */
24
+ footer?: ReactNode;
25
+ className?: string;
26
+ }
27
+ /**
28
+ * The body of a chart's tooltip: a heading over one labelled figure per series, in the order
29
+ * given. It knows nothing of the chart library; the chart hands it rows it has already resolved.
30
+ */
31
+ declare function ChartTooltipContent({ title, items, details, footer, className }: ChartTooltipContentProps): import("react").JSX.Element | null;
32
+ export { ChartTooltipContent };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import "../lib/classes.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { TooltipFigures, TooltipPanel } from "./tooltip.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/chart.tsx
7
+ /**
8
+ * The body of a chart's tooltip: a heading over one labelled figure per series, in the order
9
+ * given. It knows nothing of the chart library; the chart hands it rows it has already resolved.
10
+ */
11
+ function ChartTooltipContent({ title, items, details, footer, className }) {
12
+ if (!items.length) return null;
13
+ return /* @__PURE__ */ jsxs(TooltipPanel, {
14
+ variant: "rich",
15
+ className: cn("wrap-break-word", className),
16
+ children: [
17
+ /* @__PURE__ */ jsx(TooltipFigures, {
18
+ title,
19
+ figures: items.map((item) => ({
20
+ label: /* @__PURE__ */ jsxs("span", {
21
+ className: "flex items-center gap-1.5",
22
+ children: [/* @__PURE__ */ jsx("span", {
23
+ className: cn("size-2.5 shrink-0 rounded-[2px]", item.indicator === "outline" ? "border border-(--color-bg) border-dashed" : "bg-(--color-bg)"),
24
+ style: { "--color-bg": item.color }
25
+ }), item.label]
26
+ }),
27
+ value: item.value
28
+ }))
29
+ }),
30
+ !!details?.length && /* @__PURE__ */ jsx("div", {
31
+ className: cn("mt-2 border-t pt-0.5", "border-edge"),
32
+ children: /* @__PURE__ */ jsx(TooltipFigures, { figures: details })
33
+ }),
34
+ footer && /* @__PURE__ */ jsx("div", {
35
+ className: cn("mt-2 border-t pt-2 empty:hidden", "border-edge"),
36
+ children: footer
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ export { ChartTooltipContent };
42
+
43
+ //# sourceMappingURL=chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart.js","names":[],"sources":["../../src/components/chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProperties, ReactNode } from \"react\"\nimport { tooltipRuleClasses } from \"../lib/classes\"\nimport { cn } from \"../lib/variants\"\nimport { type TooltipFigure, TooltipFigures, TooltipPanel } from \"./tooltip\"\n\n/** A series' swatch: a solid square, or a dashed outline for a compared period. */\nexport type ChartIndicator = \"dot\" | \"outline\"\n\n/** One series' row in a chart tooltip: its swatch, its name and its figure, already formatted. */\nexport interface ChartTooltipItem {\n key: string\n label: ReactNode\n value: ReactNode\n color: string\n indicator?: ChartIndicator\n}\n\ninterface ChartTooltipContentProps {\n title?: ReactNode\n items: ChartTooltipItem[]\n /**\n * More figures of the same point that no series draws (a bucket's sessions beside its\n * visitors), under a hairline so they read as context rather than as a series.\n */\n details?: TooltipFigure[]\n /**\n * Extra content under the figures, on its own hairline-separated row (a point's notes).\n */\n footer?: ReactNode\n className?: string\n}\n\n/**\n * The body of a chart's tooltip: a heading over one labelled figure per series, in the order\n * given. It knows nothing of the chart library; the chart hands it rows it has already resolved.\n */\nfunction ChartTooltipContent({\n title,\n items,\n details,\n footer,\n className,\n}: ChartTooltipContentProps) {\n if (!items.length) return null\n\n return (\n // TanStack Charts renders this panel inside an element with `overflow-wrap: anywhere`, which\n // lets a long label break mid-word. `wrap-break-word` restores breaks between words.\n <TooltipPanel variant=\"rich\" className={cn(\"wrap-break-word\", className)}>\n {/* The same composition a row's tooltip uses, from the same component: a heading over\n labelled figures. A chart point and a breakdown row are the same kind of report, and\n two tooltips side by side that differ in their spacing read as an accident. */}\n <TooltipFigures\n title={title}\n figures={items.map(item => ({\n label: (\n <span className=\"flex items-center gap-1.5\">\n <span\n className={cn(\n \"size-2.5 shrink-0 rounded-[2px]\",\n item.indicator === \"outline\"\n ? \"border border-(--color-bg) border-dashed\"\n : \"bg-(--color-bg)\",\n )}\n style={{ \"--color-bg\": item.color } as CSSProperties}\n />\n {item.label}\n </span>\n ),\n value: item.value,\n }))}\n />\n\n {/* 8px either side of the rule, like the footer's: `pt-0.5` plus the 6px the figures\n keep above themselves. */}\n {!!details?.length && (\n <div className={cn(\"mt-2 border-t pt-0.5\", tooltipRuleClasses)}>\n <TooltipFigures figures={details} />\n </div>\n )}\n\n {/* `empty:hidden` so a footer that renders nothing (a point with no notes and no hint)\n leaves no stray rule behind: the element is truthy, its output isn't. */}\n {footer && (\n <div className={cn(\"mt-2 border-t pt-2 empty:hidden\", tooltipRuleClasses)}>{footer}</div>\n )}\n </TooltipPanel>\n )\n}\n\nexport { ChartTooltipContent }\n"],"mappings":";;;;;;;;;;AAsCA,SAAS,oBAAoB,EAC3B,OACA,OACA,SACA,QACA,aAC2B;CAC3B,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OAGE,qBAAC,cAAD;EAAc,SAAQ;EAAO,WAAW,GAAG,mBAAmB,SAAS;EAAvE,UAAA;GAIE,oBAAC,gBAAD;IACS;IACP,SAAS,MAAM,KAAI,UAAS;KAC1B,OACE,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OACE,WAAW,GACT,mCACA,KAAK,cAAc,YACf,6CACA,iBACN;OACA,OAAO,EAAE,cAAc,KAAK,MAAM;MACnC,CAAA,GACA,KAAK,KACF;;KAER,OAAO,KAAK;IACd,EAAE;GACH,CAAA;GAIA,CAAC,CAAC,SAAS,UACV,oBAAC,OAAD;IAAK,WAAW,GAAG,wBAAA,aAA0C;IAC3D,UAAA,oBAAC,gBAAD,EAAgB,SAAS,QAAU,CAAA;GAChC,CAAA;GAKN,UACC,oBAAC,OAAD;IAAK,WAAW,GAAG,mCAAA,aAAqD;IAAI,UAAA;GAAY,CAAA;EAE9E;;AAElB"}
@@ -0,0 +1,15 @@
1
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
2
+ /**
3
+ * A checkbox with a mixed state (`indeterminate`), for a matrix of settings, for the row that
4
+ * stands for several others (`role="switch"` has no mixed state), and for an option of a
5
+ * one-off action inside a dialog. A lone setting that stays on or off is a `Switch`.
6
+ *
7
+ * Unchecked, it is a raised box on the strong edge, a step above the plain one, which is too
8
+ * faint to find a 16px box by; under the pointer the edge darkens a step. Checked or mixed, it
9
+ * fills with the brand at 80%, a shade lighter than its edge, as a switch's track does. Base UI
10
+ * renders a `<span role="checkbox">` beside a hidden input, so a disabled one carries
11
+ * `data-disabled` rather than matching `:disabled`, as with `Switch`. Wrap it in a `<label>` with
12
+ * its text, or point `aria-labelledby` at the text.
13
+ */
14
+ declare function Checkbox({ className, ...props }: Checkbox$1.Root.Props): import("react").JSX.Element;
15
+ export { Checkbox };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { CheckIcon, DashIcon } from "../lib/icons.js";
3
+ import { interactiveVariants } from "../lib/interactive.js";
4
+ import { cn } from "../lib/variants.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
7
+ // src/components/checkbox.tsx
8
+ /**
9
+ * A checkbox with a mixed state (`indeterminate`), for a matrix of settings, for the row that
10
+ * stands for several others (`role="switch"` has no mixed state), and for an option of a
11
+ * one-off action inside a dialog. A lone setting that stays on or off is a `Switch`.
12
+ *
13
+ * Unchecked, it is a raised box on the strong edge, a step above the plain one, which is too
14
+ * faint to find a 16px box by; under the pointer the edge darkens a step. Checked or mixed, it
15
+ * fills with the brand at 80%, a shade lighter than its edge, as a switch's track does. Base UI
16
+ * renders a `<span role="checkbox">` beside a hidden input, so a disabled one carries
17
+ * `data-disabled` rather than matching `:disabled`, as with `Switch`. Wrap it in a `<label>` with
18
+ * its text, or point `aria-labelledby` at the text.
19
+ */
20
+ function Checkbox({ className, ...props }) {
21
+ return /* @__PURE__ */ jsx(Checkbox$1.Root, {
22
+ className: cn(interactiveVariants({ interactive: false }), "inline-flex size-4 shrink-0 items-center justify-center rounded-xs border border-edge-strong bg-surface text-brand-on shadow-control", "data-checked:border-brand data-checked:bg-brand/80", "data-indeterminate:border-brand data-indeterminate:bg-brand/80", "not-data-disabled:cursor-pointer", "hover:not-data-disabled:not-data-checked:not-data-indeterminate:border-edge-solid", "data-disabled:opacity-50", className),
23
+ ...props,
24
+ children: /* @__PURE__ */ jsxs(Checkbox$1.Indicator, {
25
+ className: "flex",
26
+ children: [/* @__PURE__ */ jsx(CheckIcon, {
27
+ size: 12,
28
+ strokeWidth: 2,
29
+ absoluteStrokeWidth: true,
30
+ className: "in-data-indeterminate:hidden"
31
+ }), /* @__PURE__ */ jsx(DashIcon, {
32
+ size: 12,
33
+ strokeWidth: 2,
34
+ absoluteStrokeWidth: true,
35
+ className: "hidden in-data-indeterminate:block"
36
+ })]
37
+ })
38
+ });
39
+ }
40
+ export { Checkbox };
41
+
42
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","names":["CheckboxPrimitive"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["\"use client\"\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\"\nimport { CheckIcon, DashIcon } from \"../lib/icons\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { cn } from \"../lib/variants\"\n\n/**\n * A checkbox with a mixed state (`indeterminate`), for a matrix of settings, for the row that\n * stands for several others (`role=\"switch\"` has no mixed state), and for an option of a\n * one-off action inside a dialog. A lone setting that stays on or off is a `Switch`.\n *\n * Unchecked, it is a raised box on the strong edge, a step above the plain one, which is too\n * faint to find a 16px box by; under the pointer the edge darkens a step. Checked or mixed, it\n * fills with the brand at 80%, a shade lighter than its edge, as a switch's track does. Base UI\n * renders a `<span role=\"checkbox\">` beside a hidden input, so a disabled one carries\n * `data-disabled` rather than matching `:disabled`, as with `Switch`. Wrap it in a `<label>` with\n * its text, or point `aria-labelledby` at the text.\n */\nfunction Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {\n // Merged outside `variants`, which cannot take Base UI's state-function `className`.\n return (\n <CheckboxPrimitive.Root\n className={cn(\n interactiveVariants({ interactive: false }),\n \"inline-flex size-4 shrink-0 items-center justify-center rounded-xs border border-edge-strong bg-surface text-brand-on shadow-control\",\n \"data-checked:border-brand data-checked:bg-brand/80\",\n \"data-indeterminate:border-brand data-indeterminate:bg-brand/80\",\n \"not-data-disabled:cursor-pointer\",\n \"hover:not-data-disabled:not-data-checked:not-data-indeterminate:border-edge-solid\",\n \"data-disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"flex\">\n <CheckIcon\n size={12}\n strokeWidth={2}\n absoluteStrokeWidth\n className=\"in-data-indeterminate:hidden\"\n />\n <DashIcon\n size={12}\n strokeWidth={2}\n absoluteStrokeWidth\n className=\"hidden in-data-indeterminate:block\"\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n}\n\nexport { Checkbox }\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,SAAS,EAAE,WAAW,GAAG,SAAuC;CAEvE,OACE,oBAACA,WAAkB,MAAnB;EACE,WAAW,GACT,oBAAoB,EAAE,aAAa,MAAM,CAAC,GAC1C,wIACA,sDACA,kEACA,oCACA,qFACA,4BACA,SACF;EACA,GAAI;EAEJ,UAAA,qBAACA,WAAkB,WAAnB;GAA6B,WAAU;GAAvC,UAAA,CACE,oBAAC,WAAD;IACE,MAAM;IACN,aAAa;IACb,qBAAA;IACA,WAAU;GACX,CAAA,GACD,oBAAC,UAAD;IACE,MAAM;IACN,aAAa;IACb,qBAAA;IACA,WAAU;GACX,CAAA,CAC0B;;CACP,CAAA;AAE5B"}
@@ -0,0 +1,21 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { ComponentProps } from "react";
3
+ declare const codeBlockVariants: import("tailwind-variants").TVReturnType<{
4
+ /**
5
+ * Wrap long lines rather than scroll them: for a snippet read and copied whole, where a line
6
+ * running off the edge hides part of what is copied, or one that would widen its dialog.
7
+ * `wrap-anywhere` rather than `break-words`: only it lets a grid or flex parent shrink the
8
+ * block below its longest unbroken run, such as a URL.
9
+ */
10
+ wrap: {
11
+ true: string;
12
+ false: string;
13
+ };
14
+ }, undefined, "rounded-lg bg-fill-subtle p-4 font-mono text-xs text-ink-secondary", undefined, undefined, undefined>;
15
+ interface CodeBlockProps extends ComponentProps<"pre">, VariantProps<typeof codeBlockVariants> {}
16
+ /**
17
+ * A block of code to read and copy, in the fill. A block that scrolls sideways
18
+ * takes focus, so a keyboard can scroll it too.
19
+ */
20
+ export declare function CodeBlock({ wrap, className, ...props }: CodeBlockProps): import("react").JSX.Element;
21
+ export {};