@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,38 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { ComponentProps } from "react";
3
+ declare const pingVariants: import("tailwind-variants").TVReturnType<{
4
+ tone: {
5
+ success: string;
6
+ warning: string;
7
+ danger: string;
8
+ neutral: string;
9
+ };
10
+ size: {
11
+ sm: string;
12
+ md: string;
13
+ lg: string;
14
+ };
15
+ /**
16
+ * An outline in the surface colour, for a dot laid over an image or another element.
17
+ */
18
+ outline: {
19
+ true: string;
20
+ };
21
+ }, undefined, "relative flex shrink-0 rounded-full", undefined, undefined, undefined>;
22
+ type PingProps = ComponentProps<"span"> & VariantProps<typeof pingVariants> & {
23
+ /**
24
+ * Glow: a soft, slow pulse around the dot, for a status that is live right now. It
25
+ * overflows the box by half the dot size, so layout stays the size of the dot itself.
26
+ */
27
+ animate?: boolean;
28
+ /**
29
+ * Names the dot for a screen reader, for a dot whose status no text beside it states.
30
+ * Without it the dot is hidden from assistive tech, since its colour alone says nothing.
31
+ */
32
+ label?: string;
33
+ };
34
+ /**
35
+ * A status dot: solid fill, optionally glowing, optionally outlined against what it sits on.
36
+ */
37
+ export declare function Ping({ className, tone, size, outline, animate, label, ...props }: PingProps): import("react").JSX.Element;
38
+ export {};
@@ -0,0 +1,50 @@
1
+ import { variants } from "../lib/variants.js";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ // src/components/ping.tsx
4
+ const pingVariants = variants({
5
+ base: "relative flex shrink-0 rounded-full",
6
+ variants: {
7
+ tone: {
8
+ success: "text-success",
9
+ warning: "text-warning",
10
+ danger: "text-danger",
11
+ neutral: "text-ink-muted"
12
+ },
13
+ size: {
14
+ sm: "size-1.5",
15
+ md: "size-2",
16
+ lg: "size-2.5"
17
+ },
18
+ /**
19
+ * An outline in the surface colour, for a dot laid over an image or another element.
20
+ */
21
+ outline: { true: "outline-2 outline-surface" }
22
+ },
23
+ defaultVariants: {
24
+ tone: "neutral",
25
+ size: "md"
26
+ }
27
+ });
28
+ /**
29
+ * A status dot: solid fill, optionally glowing, optionally outlined against what it sits on.
30
+ */
31
+ function Ping({ className, tone, size, outline, animate = false, label, ...props }) {
32
+ const named = label ? {
33
+ role: "img",
34
+ "aria-label": label
35
+ } : { "aria-hidden": true };
36
+ return /* @__PURE__ */ jsxs("span", {
37
+ className: pingVariants({
38
+ tone,
39
+ size,
40
+ outline,
41
+ className
42
+ }),
43
+ ...named,
44
+ ...props,
45
+ children: [animate && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute -inset-1/2 animate-ping rounded-full bg-current opacity-30 blur-[1px] [animation-duration:2s] motion-reduce:animate-none" }), /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute -inset-1/2 animate-pulse rounded-full bg-current opacity-30 motion-reduce:animate-none" })] }), /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full bg-current" })]
46
+ });
47
+ }
48
+ export { Ping };
49
+
50
+ //# sourceMappingURL=ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.js","names":[],"sources":["../../src/components/ping.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport type { Tone } from \"../lib/tone\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst pingVariants = variants({\n base: \"relative flex shrink-0 rounded-full\",\n\n variants: {\n tone: {\n success: \"text-success\",\n warning: \"text-warning\",\n danger: \"text-danger\",\n neutral: \"text-ink-muted\",\n } satisfies Record<Tone, string>,\n size: {\n sm: \"size-1.5\",\n md: \"size-2\",\n lg: \"size-2.5\",\n },\n /**\n * An outline in the surface colour, for a dot laid over an image or another element.\n */\n outline: {\n true: \"outline-2 outline-surface\",\n },\n },\n\n defaultVariants: {\n tone: \"neutral\",\n size: \"md\",\n },\n})\n\ntype PingProps = ComponentProps<\"span\"> &\n VariantProps<typeof pingVariants> & {\n /**\n * Glow: a soft, slow pulse around the dot, for a status that is live right now. It\n * overflows the box by half the dot size, so layout stays the size of the dot itself.\n */\n animate?: boolean\n\n /**\n * Names the dot for a screen reader, for a dot whose status no text beside it states.\n * Without it the dot is hidden from assistive tech, since its colour alone says nothing.\n */\n label?: string\n }\n\n/**\n * A status dot: solid fill, optionally glowing, optionally outlined against what it sits on.\n */\nexport function Ping({\n className,\n tone,\n size,\n outline,\n animate = false,\n label,\n ...props\n}: PingProps) {\n const named = label ? ({ role: \"img\", \"aria-label\": label } as const) : { \"aria-hidden\": true }\n\n return (\n <span className={pingVariants({ tone, size, outline, className })} {...named} {...props}>\n {animate && (\n <>\n <span className=\"pointer-events-none absolute -inset-1/2 animate-ping rounded-full bg-current opacity-30 blur-[1px] [animation-duration:2s] motion-reduce:animate-none\" />\n <span className=\"pointer-events-none absolute -inset-1/2 animate-pulse rounded-full bg-current opacity-30 motion-reduce:animate-none\" />\n </>\n )}\n <span className=\"absolute inset-0 rounded-full bg-current\" />\n </span>\n )\n}\n"],"mappings":";;;AAIA,MAAM,eAAe,SAAS;CAC5B,MAAM;CAEN,UAAU;EACR,MAAM;GACJ,SAAS;GACT,SAAS;GACT,QAAQ;GACR,SAAS;EACX;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;;;;EAIA,SAAS,EACP,MAAM,4BACR;CACF;CAEA,iBAAiB;EACf,MAAM;EACN,MAAM;CACR;AACF,CAAC;;;;AAoBD,SAAgB,KAAK,EACnB,WACA,MACA,MACA,SACA,UAAU,OACV,OACA,GAAG,SACS;CACZ,MAAM,QAAQ,QAAS;EAAE,MAAM;EAAO,cAAc;CAAM,IAAc,EAAE,eAAe,KAAK;CAE9F,OACE,qBAAC,QAAD;EAAM,WAAW,aAAa;GAAE;GAAM;GAAM;GAAS;EAAU,CAAC;EAAG,GAAI;EAAO,GAAI;EAAlF,UAAA,CACG,WACC,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD,EAAM,WAAU,wJAAyJ,CAAA,GACzK,oBAAC,QAAD,EAAM,WAAU,sHAAuH,CAAA,CACvI,EAAA,CAAA,GAEJ,oBAAC,QAAD,EAAM,WAAU,2CAA4C,CAAA,CACxD;;AAEV"}
@@ -0,0 +1,5 @@
1
+ import { Popover as Popover$1 } from "@base-ui/react/popover";
2
+ declare const Popover: typeof Popover$1.Root;
3
+ declare const PopoverTrigger: Popover$1.Trigger;
4
+ declare function PopoverContent({ className, align, side, sideOffset, anchor, collisionAvoidance, ...props }: Popover$1.Popup.Props & Pick<Popover$1.Positioner.Props, "align" | "side" | "sideOffset" | "anchor" | "collisionAvoidance">): import("react").JSX.Element;
5
+ export { Popover, PopoverContent, PopoverTrigger };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { popoverAnimationClasses, popupBackdropClasses, popupSurfaceClasses } from "../lib/classes.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Popover as Popover$1 } from "@base-ui/react/popover";
6
+ // src/components/popover.tsx
7
+ const Popover = Popover$1.Root;
8
+ const PopoverTrigger = Popover$1.Trigger;
9
+ function PopoverContent({ className, align = "center", side, sideOffset = 6, anchor, collisionAvoidance, ...props }) {
10
+ return /* @__PURE__ */ jsxs(Popover$1.Portal, { children: [/* @__PURE__ */ jsx(Popover$1.Backdrop, { className: popupBackdropClasses }), /* @__PURE__ */ jsx(Popover$1.Positioner, {
11
+ align,
12
+ side,
13
+ sideOffset,
14
+ anchor,
15
+ collisionAvoidance,
16
+ className: "isolate z-50",
17
+ children: /* @__PURE__ */ jsx(Popover$1.Popup, {
18
+ className: cn(popupSurfaceClasses, "min-w-72 w-(--anchor-width) p-4 outline-hidden", popoverAnimationClasses, className),
19
+ ...props
20
+ })
21
+ })] });
22
+ }
23
+ export { Popover, PopoverContent, PopoverTrigger };
24
+
25
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.js","names":["PopoverPrimitive"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\"\nimport {\n POPUP_SIDE_OFFSET,\n popoverAnimationClasses,\n popupBackdropClasses,\n popupSurfaceClasses,\n} from \"../lib/classes\"\nimport { cn } from \"../lib/variants\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nfunction PopoverContent({\n className,\n align = \"center\",\n side,\n sideOffset = POPUP_SIDE_OFFSET,\n anchor,\n collisionAvoidance,\n ...props\n}: PopoverPrimitive.Popup.Props &\n Pick<\n PopoverPrimitive.Positioner.Props,\n \"align\" | \"side\" | \"sideOffset\" | \"anchor\" | \"collisionAvoidance\"\n >) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Backdrop className={popupBackdropClasses} />\n <PopoverPrimitive.Positioner\n align={align}\n side={side}\n sideOffset={sideOffset}\n anchor={anchor}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50\"\n >\n <PopoverPrimitive.Popup\n className={cn(\n popupSurfaceClasses,\n \"min-w-72 w-(--anchor-width) p-4 outline-hidden\",\n popoverAnimationClasses,\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n )\n}\n\nexport { Popover, PopoverContent, PopoverTrigger }\n"],"mappings":";;;;;;AAWA,MAAM,UAAUA,UAAiB;AACjC,MAAM,iBAAiBA,UAAiB;AAExC,SAAS,eAAe,EACtB,WACA,QAAQ,UACR,MACA,aAAA,GACA,QACA,oBACA,GAAG,SAKA;CACH,OACE,qBAACA,UAAiB,QAAlB,EAAA,UAAA,CACE,oBAACA,UAAiB,UAAlB,EAA2B,WAAW,qBAAuB,CAAA,GAC7D,oBAACA,UAAiB,YAAlB;EACS;EACD;EACM;EACJ;EACY;EACpB,WAAU;EAEV,UAAA,oBAACA,UAAiB,OAAlB;GACE,WAAW,GACT,qBACA,kDACA,yBACA,SACF;GACA,GAAI;EACL,CAAA;CAC0B,CAAA,CACN,EAAA,CAAA;AAE7B"}
@@ -0,0 +1,35 @@
1
+ import { ReactNode } from "react";
2
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
3
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
4
+ /**
5
+ * One choice out of a few, each shown at once with what it means. Arrow keys move the choice,
6
+ * as in any radio group. A choice between two states is a `Switch`; a longer list is a
7
+ * `Select`.
8
+ */
9
+ declare function RadioGroup({ className, ...props }: RadioGroup$1.Props): import("react").JSX.Element;
10
+ /**
11
+ * The 16px round control, raised on `Checkbox`'s strong edge and filled with the brand once
12
+ * chosen. A `RadioCard` keeps its own lighter card edge around it. Base UI renders a
13
+ * `<span role="radio">` beside a hidden input, so a disabled one carries `data-disabled` rather
14
+ * than matching `:disabled`, as with `Checkbox`.
15
+ */
16
+ declare function Radio({ className, ...props }: Radio$1.Root.Props): import("react").JSX.Element;
17
+ interface RadioCardProps extends Omit<Radio$1.Root.Props, "children"> {
18
+ label: ReactNode;
19
+ /** What the choice means, under the label. */
20
+ description?: ReactNode;
21
+ /** Beside the label, e.g. a "Default" badge. */
22
+ badge?: ReactNode;
23
+ /**
24
+ * Why the choice cannot be made. The radio turns read-only rather than disabled, so the arrow
25
+ * keys still reach it, which they skip on a disabled one; the reason is read with it and shown
26
+ * in a tooltip, which a tap opens too.
27
+ */
28
+ disabledReason?: string;
29
+ }
30
+ /**
31
+ * A choice as a card: the radio, then its label and what it means. The whole card is the
32
+ * `<label>`, so a click anywhere on it picks the choice; the chosen card takes the fill.
33
+ */
34
+ declare function RadioCard({ label, description, badge, disabledReason, readOnly, className, ...props }: RadioCardProps): import("react").JSX.Element;
35
+ export { Radio, RadioCard, RadioGroup };
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { formatIdList } from "../lib/aria.js";
3
+ import "../lib/classes.js";
4
+ import { interactiveVariants } from "../lib/interactive.js";
5
+ import { cn } from "../lib/variants.js";
6
+ import { useDisabledReason } from "./disabled-reason.js";
7
+ import { Tooltip, showTooltip } from "./tooltip.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useId } from "react";
10
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
11
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
12
+ // src/components/radio-group.tsx
13
+ /**
14
+ * One choice out of a few, each shown at once with what it means. Arrow keys move the choice,
15
+ * as in any radio group. A choice between two states is a `Switch`; a longer list is a
16
+ * `Select`.
17
+ */
18
+ function RadioGroup({ className, ...props }) {
19
+ return /* @__PURE__ */ jsx(RadioGroup$1, {
20
+ className: cn("flex flex-col gap-2", className),
21
+ ...props
22
+ });
23
+ }
24
+ /**
25
+ * The 16px round control, raised on `Checkbox`'s strong edge and filled with the brand once
26
+ * chosen. A `RadioCard` keeps its own lighter card edge around it. Base UI renders a
27
+ * `<span role="radio">` beside a hidden input, so a disabled one carries `data-disabled` rather
28
+ * than matching `:disabled`, as with `Checkbox`.
29
+ */
30
+ function Radio({ className, ...props }) {
31
+ return /* @__PURE__ */ jsx(Radio$1.Root, {
32
+ className: cn(interactiveVariants({ interactive: false }), "inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-edge-strong bg-surface shadow-control", "data-checked:border-brand data-checked:bg-brand/80", "hover:not-data-disabled:not-data-checked:border-edge-solid", "not-data-disabled:cursor-pointer data-disabled:opacity-50", className),
33
+ ...props,
34
+ children: /* @__PURE__ */ jsx(Radio$1.Indicator, { className: "size-1.5 rounded-full bg-brand-on" })
35
+ });
36
+ }
37
+ /**
38
+ * A choice as a card: the radio, then its label and what it means. The whole card is the
39
+ * `<label>`, so a click anywhere on it picks the choice; the chosen card takes the fill.
40
+ */
41
+ function RadioCard({ label, description, badge, disabledReason, readOnly, className, ...props }) {
42
+ const id = useId();
43
+ const descriptionId = `${id}-description`;
44
+ const reason = useDisabledReason(disabledReason, formatIdList(!!description && descriptionId, props["aria-describedby"]));
45
+ return /* @__PURE__ */ jsx(Tooltip, {
46
+ id: reason.triggerId,
47
+ tooltip: disabledReason,
48
+ side: "top",
49
+ children: /* @__PURE__ */ jsxs("label", {
50
+ className: cn("flex cursor-pointer items-start gap-2.5 rounded-lg border bg-surface px-3.5 py-3 transition-colors duration-75", "has-data-checked:bg-fill", "has-data-disabled:pointer-events-none has-data-disabled:opacity-50", disabledReason ? "cursor-not-allowed opacity-50" : "hover:not-has-data-checked:bg-fill-subtle", className),
51
+ onClick: disabledReason ? () => showTooltip(reason.triggerId) : void 0,
52
+ children: [
53
+ /* @__PURE__ */ jsx(Radio, {
54
+ ...props,
55
+ "aria-labelledby": id,
56
+ "aria-describedby": reason.describedBy,
57
+ readOnly: readOnly === true || !!disabledReason,
58
+ className: cn("mt-0.5 data-disabled:opacity-100", disabledReason && "cursor-not-allowed")
59
+ }),
60
+ /* @__PURE__ */ jsxs("span", {
61
+ className: "flex min-w-0 flex-col gap-0.5",
62
+ children: [/* @__PURE__ */ jsxs("span", {
63
+ className: "flex items-center gap-2 font-medium text-sm",
64
+ children: [/* @__PURE__ */ jsx("span", {
65
+ id,
66
+ children: label
67
+ }), badge]
68
+ }), description && /* @__PURE__ */ jsx("span", {
69
+ id: descriptionId,
70
+ className: "max-w-prose text-copy text-ink-muted",
71
+ children: description
72
+ })]
73
+ }),
74
+ reason.reasonText
75
+ ]
76
+ })
77
+ });
78
+ }
79
+ export { Radio, RadioCard, RadioGroup };
80
+
81
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","names":["RadioGroupPrimitive","RadioPrimitive"],"sources":["../../src/components/radio-group.tsx"],"sourcesContent":["\"use client\"\n\nimport { Radio as RadioPrimitive } from \"@base-ui/react/radio\"\nimport { RadioGroup as RadioGroupPrimitive } from \"@base-ui/react/radio-group\"\nimport { type ReactNode, useId } from \"react\"\nimport { formatIdList } from \"../lib/aria\"\nimport { descriptionClasses } from \"../lib/classes\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { cn } from \"../lib/variants\"\nimport { useDisabledReason } from \"./disabled-reason\"\nimport { showTooltip, Tooltip } from \"./tooltip\"\n\n/**\n * One choice out of a few, each shown at once with what it means. Arrow keys move the choice,\n * as in any radio group. A choice between two states is a `Switch`; a longer list is a\n * `Select`.\n */\nfunction RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {\n return <RadioGroupPrimitive className={cn(\"flex flex-col gap-2\", className)} {...props} />\n}\n\n/**\n * The 16px round control, raised on `Checkbox`'s strong edge and filled with the brand once\n * chosen. A `RadioCard` keeps its own lighter card edge around it. Base UI renders a\n * `<span role=\"radio\">` beside a hidden input, so a disabled one carries `data-disabled` rather\n * than matching `:disabled`, as with `Checkbox`.\n */\nfunction Radio({ className, ...props }: RadioPrimitive.Root.Props) {\n // Merged outside `variants`, which cannot take Base UI's state-function `className`.\n return (\n <RadioPrimitive.Root\n className={cn(\n interactiveVariants({ interactive: false }),\n \"inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-edge-strong bg-surface shadow-control\",\n \"data-checked:border-brand data-checked:bg-brand/80\",\n \"hover:not-data-disabled:not-data-checked:border-edge-solid\",\n \"not-data-disabled:cursor-pointer data-disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator className=\"size-1.5 rounded-full bg-brand-on\" />\n </RadioPrimitive.Root>\n )\n}\n\ninterface RadioCardProps extends Omit<RadioPrimitive.Root.Props, \"children\"> {\n label: ReactNode\n /** What the choice means, under the label. */\n description?: ReactNode\n /** Beside the label, e.g. a \"Default\" badge. */\n badge?: ReactNode\n /**\n * Why the choice cannot be made. The radio turns read-only rather than disabled, so the arrow\n * keys still reach it, which they skip on a disabled one; the reason is read with it and shown\n * in a tooltip, which a tap opens too.\n */\n disabledReason?: string\n}\n\n/**\n * A choice as a card: the radio, then its label and what it means. The whole card is the\n * `<label>`, so a click anywhere on it picks the choice; the chosen card takes the fill.\n */\nfunction RadioCard({\n label,\n description,\n badge,\n disabledReason,\n readOnly,\n className,\n ...props\n}: RadioCardProps) {\n const id = useId()\n const descriptionId = `${id}-description`\n const reason = useDisabledReason(\n disabledReason,\n formatIdList(!!description && descriptionId, props[\"aria-describedby\"]),\n )\n\n return (\n <Tooltip id={reason.triggerId} tooltip={disabledReason} side=\"top\">\n {/* oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- the radio inside takes the keyboard; the click only opens the reason for a tap */}\n <label\n className={cn(\n \"flex cursor-pointer items-start gap-2.5 rounded-lg border bg-surface px-3.5 py-3 transition-colors duration-75\",\n \"has-data-checked:bg-fill\",\n \"has-data-disabled:pointer-events-none has-data-disabled:opacity-50\",\n disabledReason\n ? \"cursor-not-allowed opacity-50\"\n : \"hover:not-has-data-checked:bg-fill-subtle\",\n className,\n )}\n onClick={disabledReason ? () => showTooltip(reason.triggerId) : undefined}\n >\n {/* The card dims as a whole, so the radio does not dim a second time inside it. */}\n <Radio\n // First, so the caller's description merges with the card's own and the reason's.\n {...props}\n aria-labelledby={id}\n aria-describedby={reason.describedBy}\n readOnly={readOnly === true || !!disabledReason}\n className={cn(\"mt-0.5 data-disabled:opacity-100\", disabledReason && \"cursor-not-allowed\")}\n />\n\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"flex items-center gap-2 font-medium text-sm\">\n <span id={id}>{label}</span>\n {badge}\n </span>\n {description && (\n <span id={descriptionId} className={descriptionClasses}>\n {description}\n </span>\n )}\n </span>\n\n {reason.reasonText}\n </label>\n </Tooltip>\n )\n}\n\nexport { Radio, RadioCard, RadioGroup }\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAoC;CACtE,OAAO,oBAACA,cAAD;EAAqB,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC3F;;;;;;;AAQA,SAAS,MAAM,EAAE,WAAW,GAAG,SAAoC;CAEjE,OACE,oBAACC,QAAe,MAAhB;EACE,WAAW,GACT,oBAAoB,EAAE,aAAa,MAAM,CAAC,GAC1C,4HACA,sDACA,8DACA,6DACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAACA,QAAe,WAAhB,EAA0B,WAAU,oCAAqC,CAAA;CACtD,CAAA;AAEzB;;;;;AAoBA,SAAS,UAAU,EACjB,OACA,aACA,OACA,gBACA,UACA,WACA,GAAG,SACc;CACjB,MAAM,KAAK,MAAM;CACjB,MAAM,gBAAgB,GAAG,GAAG;CAC5B,MAAM,SAAS,kBACb,gBACA,aAAa,CAAC,CAAC,eAAe,eAAe,MAAM,mBAAmB,CACxE;CAEA,OACE,oBAAC,SAAD;EAAS,IAAI,OAAO;EAAW,SAAS;EAAgB,MAAK;EAE3D,UAAA,qBAAC,SAAD;GACE,WAAW,GACT,kHACA,4BACA,sEACA,iBACI,kCACA,6CACJ,SACF;GACA,SAAS,uBAAuB,YAAY,OAAO,SAAS,IAAI,KAAA;GAVlE,UAAA;IAaE,oBAAC,OAAD;KAEE,GAAI;KACJ,mBAAiB;KACjB,oBAAkB,OAAO;KACzB,UAAU,aAAa,QAAQ,CAAC,CAAC;KACjC,WAAW,GAAG,oCAAoC,kBAAkB,oBAAoB;IACzF,CAAA;IAED,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACE,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OAAU;OAAK,UAAA;MAAY,CAAA,GAC1B,KACG;KACL,CAAA,GAAA,eACC,oBAAC,QAAD;MAAM,IAAI;MAAe,WAAA;MACtB,UAAA;KACG,CAAA,CAEJ;;IAEL,OAAO;GACH;;CACA,CAAA;AAEb"}
@@ -0,0 +1,25 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ /** One instant as a single clock reads it. */
3
+ export interface RelativeTimeStamp {
4
+ /** The clock's name: "UTC", "GMT+2". */
5
+ label: string;
6
+ /** The day on that clock: "September 20, 2026". */
7
+ date: string;
8
+ /** The time on that clock: "04:58:20 PM". */
9
+ clock: string;
10
+ }
11
+ export interface RelativeTimeProps extends Omit<ComponentProps<"time">, "dateTime"> {
12
+ /** The instant being reported on; ISO 8601, or a `Date`. */
13
+ date: Date | string;
14
+ /** What the hover says: the full date, or how long ago above a list of `stamps`. */
15
+ tooltip: ReactNode;
16
+ /** The same instant on several clocks, one row each under `tooltip`. */
17
+ stamps?: RelativeTimeStamp[];
18
+ }
19
+ /**
20
+ * A moment printed short, with the exact one on hover. The caller formats every string, as this
21
+ * package formats no dates: the children are the short reading ("2 months ago", "14:32:05"), and
22
+ * `tooltip` is the long one. For a stamp that has to stay short on the page (a feed row, a log
23
+ * line), where the exact moment is worth one hover but not one column.
24
+ */
25
+ export declare function RelativeTime({ date, tooltip, stamps, ...props }: RelativeTimeProps): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { Badge } from "./badge.js";
3
+ import { Tooltip } from "./tooltip.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/relative-time.tsx
6
+ /**
7
+ * A moment printed short, with the exact one on hover. The caller formats every string, as this
8
+ * package formats no dates: the children are the short reading ("2 months ago", "14:32:05"), and
9
+ * `tooltip` is the long one. For a stamp that has to stay short on the page (a feed row, a log
10
+ * line), where the exact moment is worth one hover but not one column.
11
+ */
12
+ function RelativeTime({ date, tooltip, stamps, ...props }) {
13
+ const time = /* @__PURE__ */ jsx("time", {
14
+ dateTime: new Date(date).toISOString(),
15
+ ...props
16
+ });
17
+ if (!stamps?.length) return /* @__PURE__ */ jsx(Tooltip, {
18
+ tooltip,
19
+ children: time
20
+ });
21
+ return /* @__PURE__ */ jsx(Tooltip, {
22
+ variant: "rich",
23
+ side: "right",
24
+ tooltip: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
25
+ className: "text-ink-muted",
26
+ children: tooltip
27
+ }), /* @__PURE__ */ jsx("div", {
28
+ className: "mt-2.5 flex flex-col gap-1.5",
29
+ children: stamps.map((stamp) => /* @__PURE__ */ jsxs("div", {
30
+ className: "flex items-center gap-2 whitespace-nowrap",
31
+ children: [
32
+ /* @__PURE__ */ jsx(Badge, {
33
+ size: "sm",
34
+ className: "font-mono",
35
+ children: stamp.label
36
+ }),
37
+ /* @__PURE__ */ jsx("span", { children: stamp.date }),
38
+ /* @__PURE__ */ jsx("span", {
39
+ className: "ml-auto pl-4 font-mono text-ink-muted tabular-nums",
40
+ children: stamp.clock
41
+ })
42
+ ]
43
+ }, stamp.label))
44
+ })] }),
45
+ className: "max-w-sm",
46
+ children: time
47
+ });
48
+ }
49
+ export { RelativeTime };
50
+
51
+ //# sourceMappingURL=relative-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relative-time.js","names":[],"sources":["../../src/components/relative-time.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ComponentProps, ReactNode } from \"react\"\nimport { Badge } from \"./badge\"\nimport { Tooltip } from \"./tooltip\"\n\n/** One instant as a single clock reads it. */\nexport interface RelativeTimeStamp {\n /** The clock's name: \"UTC\", \"GMT+2\". */\n label: string\n /** The day on that clock: \"September 20, 2026\". */\n date: string\n /** The time on that clock: \"04:58:20 PM\". */\n clock: string\n}\n\nexport interface RelativeTimeProps extends Omit<ComponentProps<\"time\">, \"dateTime\"> {\n /** The instant being reported on; ISO 8601, or a `Date`. */\n date: Date | string\n /** What the hover says: the full date, or how long ago above a list of `stamps`. */\n tooltip: ReactNode\n /** The same instant on several clocks, one row each under `tooltip`. */\n stamps?: RelativeTimeStamp[]\n}\n\n/**\n * A moment printed short, with the exact one on hover. The caller formats every string, as this\n * package formats no dates: the children are the short reading (\"2 months ago\", \"14:32:05\"), and\n * `tooltip` is the long one. For a stamp that has to stay short on the page (a feed row, a log\n * line), where the exact moment is worth one hover but not one column.\n */\nexport function RelativeTime({ date, tooltip, stamps, ...props }: RelativeTimeProps) {\n const time = <time dateTime={new Date(date).toISOString()} {...props} />\n\n if (!stamps?.length) return <Tooltip tooltip={tooltip}>{time}</Tooltip>\n\n return (\n <Tooltip\n variant=\"rich\"\n side=\"right\"\n tooltip={\n <>\n {/* The date carries the weight: it is what a reader came for. How long ago frames\n it and the clock qualifies it, so both sit back a shade. */}\n <div className=\"text-ink-muted\">{tooltip}</div>\n\n <div className=\"mt-2.5 flex flex-col gap-1.5\">\n {stamps.map(stamp => (\n // The date hangs off its own zone rather than a column the two rows share, so a\n // wider label pushes its date along instead of indenting both. The clocks still\n // end together, which is where a pair of them is read.\n <div key={stamp.label} className=\"flex items-center gap-2 whitespace-nowrap\">\n <Badge size=\"sm\" className=\"font-mono\">\n {stamp.label}\n </Badge>\n <span>{stamp.date}</span>\n <span className=\"ml-auto pl-4 font-mono text-ink-muted tabular-nums\">\n {stamp.clock}\n </span>\n </div>\n ))}\n </div>\n </>\n }\n // Wider than a rich tooltip's own ceiling: two zones, two dates and two clocks on one\n // line each, and the longer label must not fold its date onto a second line.\n className=\"max-w-sm\"\n >\n {time}\n </Tooltip>\n )\n}\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,aAAa,EAAE,MAAM,SAAS,QAAQ,GAAG,SAA4B;CACnF,MAAM,OAAO,oBAAC,QAAD;EAAM,UAAU,IAAI,KAAK,IAAI,CAAC,CAAC,YAAY;EAAG,GAAI;CAAQ,CAAA;CAEvE,IAAI,CAAC,QAAQ,QAAQ,OAAO,oBAAC,SAAD;EAAkB;EAAU,UAAA;CAAc,CAAA;CAEtE,OACE,oBAAC,SAAD;EACE,SAAQ;EACR,MAAK;EACL,SACE,qBAAA,UAAA,EAAA,UAAA,CAGE,oBAAC,OAAD;GAAK,WAAU;GAAkB,UAAA;EAAa,CAAA,GAE9C,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,OAAO,KAAI,UAIV,qBAAC,OAAD;IAAuB,WAAU;IAAjC,UAAA;KACE,oBAAC,OAAD;MAAO,MAAK;MAAK,WAAU;MACxB,UAAA,MAAM;KACF,CAAA;KACP,oBAAC,QAAD,EAAA,UAAO,MAAM,KAAW,CAAA;KACxB,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,MAAM;KACH,CAAA;IACH;GARK,GAAA,MAAM,KAQX,CACN;EACE,CAAA,CACL,EAAA,CAAA;EAIJ,WAAU;EAET,UAAA;CACM,CAAA;AAEb"}
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+ interface SavedMarkProps {
3
+ /** A count the caller bumps after each save; every change shows the mark again. */
4
+ saves: number;
5
+ /** How long the mark stays, in milliseconds. */
6
+ duration?: number;
7
+ label?: ReactNode;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * The note an autosaved control shows beside its label for a moment after each save. Screen
12
+ * readers hear it through a status region instead of the visible mark.
13
+ */
14
+ export declare function SavedMark({ saves, duration, label, className }: SavedMarkProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { CheckIcon } from "../lib/icons.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useState } from "react";
6
+ // src/components/saved-mark.tsx
7
+ const markClasses = ["inline-flex items-center gap-1 font-medium text-success-ink text-xs", "transition-[opacity,filter,translate] motion-reduce:transition-opacity"];
8
+ const markShownClasses = "opacity-100 blur-none translate-x-0 duration-200 ease-swap";
9
+ const markHiddenClasses = ["pointer-events-none opacity-0 blur-[4px] -translate-x-1 duration-150 ease-out", "motion-reduce:blur-none motion-reduce:translate-x-0"];
10
+ const iconClasses = "size-3.5 transition-[scale] duration-200 ease-swap motion-reduce:scale-100";
11
+ /**
12
+ * The note an autosaved control shows beside its label for a moment after each save. Screen
13
+ * readers hear it through a status region instead of the visible mark.
14
+ */
15
+ function SavedMark({ saves, duration = 2e3, label = "Saved", className }) {
16
+ const [visible, setVisible] = useState(false);
17
+ const [seen, setSeen] = useState(saves);
18
+ if (saves !== seen) {
19
+ setSeen(saves);
20
+ setVisible(true);
21
+ }
22
+ useEffect(() => {
23
+ if (!visible) return;
24
+ const timer = setTimeout(() => setVisible(false), duration);
25
+ return () => clearTimeout(timer);
26
+ }, [
27
+ visible,
28
+ saves,
29
+ duration
30
+ ]);
31
+ return /* @__PURE__ */ jsxs("span", {
32
+ className: cn("inline-flex items-center align-middle", className),
33
+ children: [/* @__PURE__ */ jsxs("span", {
34
+ "aria-hidden": true,
35
+ className: cn(markClasses, visible ? markShownClasses : markHiddenClasses),
36
+ children: [/* @__PURE__ */ jsx(CheckIcon, { className: cn(iconClasses, visible ? "scale-100" : "scale-[0.25]") }), label]
37
+ }), /* @__PURE__ */ jsx("output", {
38
+ className: "sr-only",
39
+ children: visible && label
40
+ })]
41
+ });
42
+ }
43
+ export { SavedMark };
44
+
45
+ //# sourceMappingURL=saved-mark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saved-mark.js","names":[],"sources":["../../src/components/saved-mark.tsx"],"sourcesContent":["\"use client\"\n\nimport { type ReactNode, useEffect, useState } from \"react\"\nimport { CheckIcon } from \"../lib/icons\"\nimport { cn } from \"../lib/variants\"\n\n/*\n * Both states stay mounted and change by transition, so a save during the fade-out turns it\n * around. The exit is quicker and plainer than the enter; reduced motion keeps the fade alone.\n */\nconst markClasses = [\n \"inline-flex items-center gap-1 font-medium text-success-ink text-xs\",\n \"transition-[opacity,filter,translate] motion-reduce:transition-opacity\",\n]\nconst markShownClasses = \"opacity-100 blur-none translate-x-0 duration-200 ease-swap\"\nconst markHiddenClasses = [\n \"pointer-events-none opacity-0 blur-[4px] -translate-x-1 duration-150 ease-out\",\n \"motion-reduce:blur-none motion-reduce:translate-x-0\",\n]\n\nconst iconClasses = \"size-3.5 transition-[scale] duration-200 ease-swap motion-reduce:scale-100\"\n\ninterface SavedMarkProps {\n /** A count the caller bumps after each save; every change shows the mark again. */\n saves: number\n /** How long the mark stays, in milliseconds. */\n duration?: number\n label?: ReactNode\n className?: string\n}\n\n/**\n * The note an autosaved control shows beside its label for a moment after each save. Screen\n * readers hear it through a status region instead of the visible mark.\n */\nexport function SavedMark({ saves, duration = 2000, label = \"Saved\", className }: SavedMarkProps) {\n const [visible, setVisible] = useState(false)\n const [seen, setSeen] = useState(saves)\n\n // A changed count shows the mark; the first render only records the count.\n if (saves !== seen) {\n setSeen(saves)\n setVisible(true)\n }\n\n // Keyed on the count too, so a save while shown restarts the timer.\n useEffect(() => {\n if (!visible) return\n const timer = setTimeout(() => setVisible(false), duration)\n return () => clearTimeout(timer)\n }, [visible, saves, duration])\n\n return (\n <span className={cn(\"inline-flex items-center align-middle\", className)}>\n <span aria-hidden className={cn(markClasses, visible ? markShownClasses : markHiddenClasses)}>\n <CheckIcon className={cn(iconClasses, visible ? \"scale-100\" : \"scale-[0.25]\")} />\n {label}\n </span>\n\n <output className=\"sr-only\">{visible && label}</output>\n </span>\n )\n}\n"],"mappings":";;;;;;AAUA,MAAM,cAAc,CAClB,uEACA,wEACF;AACA,MAAM,mBAAmB;AACzB,MAAM,oBAAoB,CACxB,iFACA,qDACF;AAEA,MAAM,cAAc;;;;;AAepB,SAAgB,UAAU,EAAE,OAAO,WAAW,KAAM,QAAQ,SAAS,aAA6B;CAChG,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAGtC,IAAI,UAAU,MAAM;EAClB,QAAQ,KAAK;EACb,WAAW,IAAI;CACjB;CAGA,gBAAgB;EACd,IAAI,CAAC,SAAS;EACd,MAAM,QAAQ,iBAAiB,WAAW,KAAK,GAAG,QAAQ;EAC1D,aAAa,aAAa,KAAK;CACjC,GAAG;EAAC;EAAS;EAAO;CAAQ,CAAC;CAE7B,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,yCAAyC,SAAS;EAAtE,UAAA,CACE,qBAAC,QAAD;GAAM,eAAA;GAAY,WAAW,GAAG,aAAa,UAAU,mBAAmB,iBAAiB;GAA3F,UAAA,CACE,oBAAC,WAAD,EAAW,WAAW,GAAG,aAAa,UAAU,cAAc,cAAc,EAAI,CAAA,GAC/E,KACG;EAEN,CAAA,GAAA,oBAAC,UAAD;GAAQ,WAAU;GAAW,UAAA,WAAW;EAAc,CAAA,CAClD;;AAEV"}
@@ -0,0 +1,13 @@
1
+ import { Input } from "./input.js";
2
+ import { ComponentProps } from "react";
3
+ type SearchInputProps = Omit<ComponentProps<typeof Input>, "value" | "onChange"> & {
4
+ value: string;
5
+ onValueChange: (value: string) => void;
6
+ };
7
+ /**
8
+ * Text input with a leading search icon and a clear button once it holds a value. Labels and
9
+ * placeholders come from the caller. Clearing puts focus back in the field, since the button
10
+ * that held it unmounts with the value.
11
+ */
12
+ export declare function SearchInput({ ref, value, onValueChange, className, ...props }: SearchInputProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { CancelIcon, SearchIcon } from "../lib/icons.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { Button } from "./button.js";
5
+ import { Input } from "./input.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useImperativeHandle, useRef } from "react";
8
+ // src/components/search-input.tsx
9
+ /**
10
+ * Text input with a leading search icon and a clear button once it holds a value. Labels and
11
+ * placeholders come from the caller. Clearing puts focus back in the field, since the button
12
+ * that held it unmounts with the value.
13
+ */
14
+ function SearchInput({ ref, value, onValueChange, className, ...props }) {
15
+ const inputRef = useRef(null);
16
+ useImperativeHandle(ref, () => inputRef.current);
17
+ return /* @__PURE__ */ jsxs("div", {
18
+ className: cn("relative", className),
19
+ children: [
20
+ /* @__PURE__ */ jsx(SearchIcon, { className: "pointer-events-none absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-ink-muted" }),
21
+ /* @__PURE__ */ jsx(Input, {
22
+ ref: inputRef,
23
+ value,
24
+ className: "pr-9 pl-8.5",
25
+ onChange: (event) => onValueChange(event.target.value),
26
+ ...props
27
+ }),
28
+ value.length > 0 && /* @__PURE__ */ jsx(Button, {
29
+ variant: "ghost",
30
+ size: "sm",
31
+ "aria-label": "Clear search",
32
+ prefix: /* @__PURE__ */ jsx(CancelIcon, {}),
33
+ className: "absolute top-1/2 right-0.5 -translate-y-1/2 rounded",
34
+ onClick: () => {
35
+ onValueChange("");
36
+ inputRef.current?.focus();
37
+ }
38
+ })
39
+ ]
40
+ });
41
+ }
42
+ export { SearchInput };
43
+
44
+ //# sourceMappingURL=search-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-input.js","names":[],"sources":["../../src/components/search-input.tsx"],"sourcesContent":["\"use client\"\n\nimport { type ComponentProps, useImperativeHandle, useRef } from \"react\"\nimport { CancelIcon, SearchIcon } from \"../lib/icons\"\nimport { cn } from \"../lib/variants\"\nimport { Button } from \"./button\"\nimport { Input } from \"./input\"\n\ntype SearchInputProps = Omit<ComponentProps<typeof Input>, \"value\" | \"onChange\"> & {\n value: string\n onValueChange: (value: string) => void\n}\n\n/**\n * Text input with a leading search icon and a clear button once it holds a value. Labels and\n * placeholders come from the caller. Clearing puts focus back in the field, since the button\n * that held it unmounts with the value.\n */\nexport function SearchInput({ ref, value, onValueChange, className, ...props }: SearchInputProps) {\n const inputRef = useRef<HTMLInputElement>(null)\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement)\n\n return (\n <div className={cn(\"relative\", className)}>\n <SearchIcon className=\"pointer-events-none absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-ink-muted\" />\n\n <Input\n ref={inputRef}\n value={value}\n className=\"pr-9 pl-8.5\"\n onChange={event => onValueChange(event.target.value)}\n {...props}\n />\n\n {value.length > 0 && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-label=\"Clear search\"\n prefix={<CancelIcon />}\n className=\"absolute top-1/2 right-0.5 -translate-y-1/2 rounded\"\n onClick={() => {\n onValueChange(\"\")\n inputRef.current?.focus()\n }}\n />\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAgB,YAAY,EAAE,KAAK,OAAO,eAAe,WAAW,GAAG,SAA2B;CAChG,MAAM,WAAW,OAAyB,IAAI;CAC9C,oBAAoB,WAAW,SAAS,OAA2B;CAEnE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS;EAAxC,UAAA;GACE,oBAAC,YAAD,EAAY,WAAU,uFAAwF,CAAA;GAE9G,oBAAC,OAAD;IACE,KAAK;IACE;IACP,WAAU;IACV,WAAU,UAAS,cAAc,MAAM,OAAO,KAAK;IACnD,GAAI;GACL,CAAA;GAEA,MAAM,SAAS,KACd,oBAAC,QAAD;IACE,SAAQ;IACR,MAAK;IACL,cAAW;IACX,QAAQ,oBAAC,YAAD,CAAa,CAAA;IACrB,WAAU;IACV,eAAe;KACb,cAAc,EAAE;KAChB,SAAS,SAAS,MAAM;IAC1B;GACD,CAAA;EAEA;;AAET"}
@@ -0,0 +1,83 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { HeadingProps } from "./heading.js";
3
+ import { Stack } from "./stack.js";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { ComponentProps, ReactNode } from "react";
6
+ declare const sectionHeaderVariants: import("tailwind-variants").TVReturnType<{
7
+ alignment: {
8
+ left: string;
9
+ center: string;
10
+ };
11
+ size: {
12
+ page: string[];
13
+ card: string;
14
+ panel: string;
15
+ hero: string;
16
+ };
17
+ wrap: {
18
+ true: string;
19
+ false: string;
20
+ };
21
+ }, undefined, "flex items-center w-full min-w-0", undefined, undefined, undefined>;
22
+ type SectionHeaderProps = Omit<useRender.ComponentProps<"div">, "title"> & Omit<VariantProps<typeof sectionHeaderVariants>, "wrap"> & {
23
+ /**
24
+ * Keep the title block and the actions on one line instead of wrapping them.
25
+ */
26
+ wrap?: boolean;
27
+ /**
28
+ * Title block. Given any of `title`/`description`/`leading`/`actions`, the header renders
29
+ * its own `SectionHeaderBody` (empty if there is nothing but actions, so they still sit right);
30
+ * leave them all out to compose the body by hand, e.g. an entity header with dot-joined
31
+ * meta or the dashboard greeting.
32
+ */
33
+ title?: ReactNode;
34
+ description?: ReactNode;
35
+ actions?: ReactNode;
36
+ /**
37
+ * The link back to the list a record belongs to, above its title.
38
+ */
39
+ back?: ReactNode;
40
+ /**
41
+ * Leading visual beside the title, e.g. an entity avatar.
42
+ */
43
+ leading?: ReactNode;
44
+ };
45
+ /**
46
+ * The one header for every surface in the app: pages, cards, list panels, dialogs and settings
47
+ * sections. Pass `title`/`description`/`actions` for the standard block, or compose
48
+ * `SectionHeaderBody` + `SectionHeaderActions` as children when the content is bespoke.
49
+ */
50
+ declare function SectionHeader({ className, alignment, size, wrap, title, description, actions, back, leading, children, render, ...props }: SectionHeaderProps): import("react").JSX.Element;
51
+ /**
52
+ * The page title. Its visual size and semantic level both follow the header's `size`, so a
53
+ * page heading stays the route's single `<h1>` while cards and panels render `<h2>`s. Pass
54
+ * `size`/`as` to override either one on its own.
55
+ */
56
+ declare function SectionHeaderTitle({ size, as, className, ...props }: HeadingProps): import("react").JSX.Element;
57
+ /**
58
+ * The link back to the list a record belongs to, over the title: muted, one size on every
59
+ * page. The caller passes the link with its chevron.
60
+ */
61
+ declare function SectionHeaderBack({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
62
+ type SectionHeaderBodyProps = ComponentProps<"div"> & {
63
+ /**
64
+ * Leading visual, e.g. an entity avatar.
65
+ */
66
+ leading?: ReactNode;
67
+ };
68
+ /**
69
+ * The one title block for every header in the app (pages, cards, dialogs, settings sections):
70
+ * an optional leading visual beside a column of `SectionHeaderTitle` + `SectionHeaderDescription`. Change the
71
+ * spacing here and it changes everywhere.
72
+ */
73
+ declare function SectionHeaderBody({ leading, children, className, ...props }: SectionHeaderBodyProps): import("react").JSX.Element;
74
+ /**
75
+ * The muted line under a title. Wraps by default; pass `truncate` for one-line entity meta.
76
+ */
77
+ declare function SectionHeaderDescription({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
78
+ /**
79
+ * Right-aligned actions. Stops shrinking when the header is `wrap={false}`, so a long title
80
+ * truncates instead of squeezing the buttons.
81
+ */
82
+ declare function SectionHeaderActions({ className, ...props }: ComponentProps<typeof Stack>): import("react").JSX.Element;
83
+ export { SectionHeader, SectionHeaderActions, SectionHeaderBack, SectionHeaderBody, SectionHeaderDescription, SectionHeaderTitle };