@underpin/ui 0.0.0-stage → 2.0.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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  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/button-group.d.ts +17 -0
  19. package/components/button-group.js +27 -0
  20. package/components/button-group.js.map +1 -0
  21. package/components/button.d.ts +39 -0
  22. package/components/button.js +128 -0
  23. package/components/button.js.map +1 -0
  24. package/components/calendar.d.ts +27 -0
  25. package/components/calendar.js +95 -0
  26. package/components/calendar.js.map +1 -0
  27. package/components/callout.d.ts +26 -0
  28. package/components/callout.js +71 -0
  29. package/components/callout.js.map +1 -0
  30. package/components/card.d.ts +55 -0
  31. package/components/card.js +96 -0
  32. package/components/card.js.map +1 -0
  33. package/components/chart.d.ts +32 -0
  34. package/components/chart.js +43 -0
  35. package/components/chart.js.map +1 -0
  36. package/components/checkbox.d.ts +15 -0
  37. package/components/checkbox.js +42 -0
  38. package/components/checkbox.js.map +1 -0
  39. package/components/code-block.d.ts +21 -0
  40. package/components/code-block.js +35 -0
  41. package/components/code-block.js.map +1 -0
  42. package/components/collapse.d.ts +14 -0
  43. package/components/collapse.js +25 -0
  44. package/components/collapse.js.map +1 -0
  45. package/components/combobox.d.ts +71 -0
  46. package/components/combobox.js +155 -0
  47. package/components/combobox.js.map +1 -0
  48. package/components/copy-button.d.ts +29 -0
  49. package/components/copy-button.js +100 -0
  50. package/components/copy-button.js.map +1 -0
  51. package/components/copy-input.d.ts +15 -0
  52. package/components/copy-input.js +51 -0
  53. package/components/copy-input.js.map +1 -0
  54. package/components/date-picker-trigger.d.ts +12 -0
  55. package/components/date-picker-trigger.js +30 -0
  56. package/components/date-picker-trigger.js.map +1 -0
  57. package/components/date-picker.d.ts +36 -0
  58. package/components/date-picker.js +70 -0
  59. package/components/date-picker.js.map +1 -0
  60. package/components/detail-row.d.ts +51 -0
  61. package/components/detail-row.js +77 -0
  62. package/components/detail-row.js.map +1 -0
  63. package/components/dialog.d.ts +121 -0
  64. package/components/dialog.js +327 -0
  65. package/components/dialog.js.map +1 -0
  66. package/components/disabled-reason.d.ts +31 -0
  67. package/components/disabled-reason.js +67 -0
  68. package/components/disabled-reason.js.map +1 -0
  69. package/components/empty-state.d.ts +41 -0
  70. package/components/empty-state.js +84 -0
  71. package/components/empty-state.js.map +1 -0
  72. package/components/entity-avatar.d.ts +54 -0
  73. package/components/entity-avatar.js +68 -0
  74. package/components/entity-avatar.js.map +1 -0
  75. package/components/form-section.d.ts +22 -0
  76. package/components/form-section.js +38 -0
  77. package/components/form-section.js.map +1 -0
  78. package/components/form.d.ts +199 -0
  79. package/components/form.js +456 -0
  80. package/components/form.js.map +1 -0
  81. package/components/formatted-number.d.ts +21 -0
  82. package/components/formatted-number.js +13 -0
  83. package/components/formatted-number.js.map +1 -0
  84. package/components/heading.d.ts +23 -0
  85. package/components/heading.js +44 -0
  86. package/components/heading.js.map +1 -0
  87. package/components/icon-swap.d.ts +15 -0
  88. package/components/icon-swap.js +29 -0
  89. package/components/icon-swap.js.map +1 -0
  90. package/components/inline-action.d.ts +21 -0
  91. package/components/inline-action.js +36 -0
  92. package/components/inline-action.js.map +1 -0
  93. package/components/input.d.ts +51 -0
  94. package/components/input.js +52 -0
  95. package/components/input.js.map +1 -0
  96. package/components/kbd.d.ts +17 -0
  97. package/components/kbd.js +34 -0
  98. package/components/kbd.js.map +1 -0
  99. package/components/label.d.ts +10 -0
  100. package/components/label.js +20 -0
  101. package/components/label.js.map +1 -0
  102. package/components/menu.d.ts +77 -0
  103. package/components/menu.js +189 -0
  104. package/components/menu.js.map +1 -0
  105. package/components/nav-button.d.ts +34 -0
  106. package/components/nav-button.js +71 -0
  107. package/components/nav-button.js.map +1 -0
  108. package/components/nav.d.ts +39 -0
  109. package/components/nav.js +68 -0
  110. package/components/nav.js.map +1 -0
  111. package/components/number-input.d.ts +16 -0
  112. package/components/number-input.js +25 -0
  113. package/components/number-input.js.map +1 -0
  114. package/components/page.d.ts +14 -0
  115. package/components/page.js +23 -0
  116. package/components/page.js.map +1 -0
  117. package/components/pagination.d.ts +15 -0
  118. package/components/pagination.js +63 -0
  119. package/components/pagination.js.map +1 -0
  120. package/components/ping.d.ts +38 -0
  121. package/components/ping.js +50 -0
  122. package/components/ping.js.map +1 -0
  123. package/components/popover.d.ts +5 -0
  124. package/components/popover.js +25 -0
  125. package/components/popover.js.map +1 -0
  126. package/components/radio-group.d.ts +35 -0
  127. package/components/radio-group.js +81 -0
  128. package/components/radio-group.js.map +1 -0
  129. package/components/relative-time.d.ts +25 -0
  130. package/components/relative-time.js +51 -0
  131. package/components/relative-time.js.map +1 -0
  132. package/components/saved-mark.d.ts +15 -0
  133. package/components/saved-mark.js +45 -0
  134. package/components/saved-mark.js.map +1 -0
  135. package/components/search-input.d.ts +13 -0
  136. package/components/search-input.js +44 -0
  137. package/components/search-input.js.map +1 -0
  138. package/components/section-header.d.ts +83 -0
  139. package/components/section-header.js +170 -0
  140. package/components/section-header.js.map +1 -0
  141. package/components/segmented-control.d.ts +24 -0
  142. package/components/segmented-control.js +70 -0
  143. package/components/segmented-control.js.map +1 -0
  144. package/components/select.d.ts +28 -0
  145. package/components/select.js +129 -0
  146. package/components/select.js.map +1 -0
  147. package/components/shortcut-keys.d.ts +14 -0
  148. package/components/shortcut-keys.js +32 -0
  149. package/components/shortcut-keys.js.map +1 -0
  150. package/components/shortcuts-dialog.d.ts +10 -0
  151. package/components/shortcuts-dialog.js +92 -0
  152. package/components/shortcuts-dialog.js.map +1 -0
  153. package/components/skeleton.d.ts +8 -0
  154. package/components/skeleton.js +23 -0
  155. package/components/skeleton.js.map +1 -0
  156. package/components/sparkline.d.ts +25 -0
  157. package/components/sparkline.js +70 -0
  158. package/components/sparkline.js.map +1 -0
  159. package/components/stack.d.ts +21 -0
  160. package/components/stack.js +45 -0
  161. package/components/stack.js.map +1 -0
  162. package/components/stat-strip.d.ts +43 -0
  163. package/components/stat-strip.js +151 -0
  164. package/components/stat-strip.js.map +1 -0
  165. package/components/steps.d.ts +19 -0
  166. package/components/steps.js +25 -0
  167. package/components/steps.js.map +1 -0
  168. package/components/switch.d.ts +16 -0
  169. package/components/switch.js +29 -0
  170. package/components/switch.js.map +1 -0
  171. package/components/tabs.d.ts +18 -0
  172. package/components/tabs.js +65 -0
  173. package/components/tabs.js.map +1 -0
  174. package/components/text-link.d.ts +16 -0
  175. package/components/text-link.js +32 -0
  176. package/components/text-link.js.map +1 -0
  177. package/components/textarea.d.ts +10 -0
  178. package/components/textarea.js +23 -0
  179. package/components/textarea.js.map +1 -0
  180. package/components/theme.d.ts +28 -0
  181. package/components/theme.js +158 -0
  182. package/components/theme.js.map +1 -0
  183. package/components/time-series-chart.d.ts +122 -0
  184. package/components/time-series-chart.js +722 -0
  185. package/components/time-series-chart.js.map +1 -0
  186. package/components/toaster.d.ts +3 -0
  187. package/components/toaster.js +44 -0
  188. package/components/toaster.js.map +1 -0
  189. package/components/tooltip.d.ts +64 -0
  190. package/components/tooltip.js +126 -0
  191. package/components/tooltip.js.map +1 -0
  192. package/components/view-picker.d.ts +20 -0
  193. package/components/view-picker.js +24 -0
  194. package/components/view-picker.js.map +1 -0
  195. package/fonts/inter-OFL.txt +93 -0
  196. package/fonts/inter-cyrillic-ext.woff2 +0 -0
  197. package/fonts/inter-cyrillic.woff2 +0 -0
  198. package/fonts/inter-greek-ext.woff2 +0 -0
  199. package/fonts/inter-greek.woff2 +0 -0
  200. package/fonts/inter-latin-ext.woff2 +0 -0
  201. package/fonts/inter-latin.woff2 +0 -0
  202. package/fonts/inter-vietnamese.woff2 +0 -0
  203. package/fonts.css +83 -0
  204. package/lib/animation.d.ts +14 -0
  205. package/lib/animation.js +20 -0
  206. package/lib/animation.js.map +1 -0
  207. package/lib/aria.d.ts +5 -0
  208. package/lib/aria.js +12 -0
  209. package/lib/aria.js.map +1 -0
  210. package/lib/chart-curve.d.ts +13 -0
  211. package/lib/chart-curve.js +79 -0
  212. package/lib/chart-curve.js.map +1 -0
  213. package/lib/classes.d.ts +134 -0
  214. package/lib/classes.js +152 -0
  215. package/lib/classes.js.map +1 -0
  216. package/lib/color.d.ts +25 -0
  217. package/lib/color.js +149 -0
  218. package/lib/color.js.map +1 -0
  219. package/lib/day.d.ts +9 -0
  220. package/lib/day.js +20 -0
  221. package/lib/day.js.map +1 -0
  222. package/lib/design-tokens.d.ts +56 -0
  223. package/lib/design-tokens.js +196 -0
  224. package/lib/design-tokens.js.map +1 -0
  225. package/lib/icon.d.ts +17 -0
  226. package/lib/icon.js +34 -0
  227. package/lib/icon.js.map +1 -0
  228. package/lib/icons.d.ts +23 -0
  229. package/lib/icons.js +28 -0
  230. package/lib/icons.js.map +1 -0
  231. package/lib/interactive.d.ts +21 -0
  232. package/lib/interactive.js +31 -0
  233. package/lib/interactive.js.map +1 -0
  234. package/lib/media.d.ts +58 -0
  235. package/lib/media.js +116 -0
  236. package/lib/media.js.map +1 -0
  237. package/lib/segmented.d.ts +57 -0
  238. package/lib/segmented.js +83 -0
  239. package/lib/segmented.js.map +1 -0
  240. package/lib/shortcuts.d.ts +94 -0
  241. package/lib/shortcuts.js +271 -0
  242. package/lib/shortcuts.js.map +1 -0
  243. package/lib/slot.d.ts +9 -0
  244. package/lib/slot.js +18 -0
  245. package/lib/slot.js.map +1 -0
  246. package/lib/time-series.d.ts +100 -0
  247. package/lib/time-series.js +144 -0
  248. package/lib/time-series.js.map +1 -0
  249. package/lib/tone.d.ts +6 -0
  250. package/lib/tone.js +0 -0
  251. package/lib/variants.d.ts +12 -0
  252. package/lib/variants.js +14 -0
  253. package/lib/variants.js.map +1 -0
  254. package/package.json +116 -4
  255. package/styles.css +619 -0
  256. package/tokens.d.ts +104 -0
  257. package/tokens.js +108 -0
  258. package/tokens.js.map +1 -0
@@ -0,0 +1,45 @@
1
+ import { variants } from "../lib/variants.js";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ // src/components/stack.tsx
4
+ const stackVariants = variants({
5
+ base: "flex",
6
+ variants: {
7
+ size: {
8
+ xs: "gap-1",
9
+ sm: "gap-x-2 gap-y-1",
10
+ md: "gap-x-3 gap-y-2",
11
+ lg: "gap-x-4 gap-y-3"
12
+ },
13
+ direction: {
14
+ row: "flex-row items-center place-content-start",
15
+ column: "flex-col items-start"
16
+ },
17
+ wrap: {
18
+ true: "flex-wrap",
19
+ false: ""
20
+ }
21
+ },
22
+ defaultVariants: {
23
+ size: "md",
24
+ direction: "row",
25
+ wrap: true
26
+ }
27
+ });
28
+ function Stack({ className, render, size, direction, wrap, ...props }) {
29
+ return useRender({
30
+ render,
31
+ defaultTagName: "div",
32
+ props: {
33
+ className: stackVariants({
34
+ size,
35
+ direction,
36
+ wrap,
37
+ className
38
+ }),
39
+ ...props
40
+ }
41
+ });
42
+ }
43
+ export { Stack };
44
+
45
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","names":[],"sources":["../../src/components/stack.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst stackVariants = variants({\n base: \"flex\",\n\n variants: {\n size: {\n xs: \"gap-1\",\n sm: \"gap-x-2 gap-y-1\",\n md: \"gap-x-3 gap-y-2\",\n lg: \"gap-x-4 gap-y-3\",\n },\n direction: {\n row: \"flex-row items-center place-content-start\",\n column: \"flex-col items-start\",\n },\n wrap: {\n true: \"flex-wrap\",\n false: \"\",\n },\n },\n\n defaultVariants: {\n size: \"md\",\n direction: \"row\",\n wrap: true,\n },\n})\n\ntype StackProps = useRender.ComponentProps<\"div\"> & VariantProps<typeof stackVariants>\n\nfunction Stack({ className, render, size, direction, wrap, ...props }: StackProps) {\n return useRender({\n render,\n defaultTagName: \"div\",\n props: { className: stackVariants({ size, direction, wrap, className }), ...props },\n })\n}\n\nexport { Stack }\n"],"mappings":";;;AAGA,MAAM,gBAAgB,SAAS;CAC7B,MAAM;CAEN,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,WAAW;GACT,KAAK;GACL,QAAQ;EACV;EACA,MAAM;GACJ,MAAM;GACN,OAAO;EACT;CACF;CAEA,iBAAiB;EACf,MAAM;EACN,WAAW;EACX,MAAM;CACR;AACF,CAAC;AAID,SAAS,MAAM,EAAE,WAAW,QAAQ,MAAM,WAAW,MAAM,GAAG,SAAqB;CACjF,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GAAE,WAAW,cAAc;IAAE;IAAM;IAAW;IAAM;GAAU,CAAC;GAAG,GAAG;EAAM;CACpF,CAAC;AACH"}
@@ -0,0 +1,43 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { NumberFormat } from "./formatted-number.js";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { ComponentProps, ReactNode } from "react";
5
+ declare const stripVariants: import("tailwind-variants").TVReturnType<{
6
+ variant: {
7
+ plain: string;
8
+ track: string;
9
+ };
10
+ row: {
11
+ lg: string;
12
+ wide: string;
13
+ };
14
+ }, undefined, string[], undefined, undefined, undefined>;
15
+ interface StatStripProps extends Omit<ComponentProps<"div">, "ref">, VariantProps<typeof stripVariants> {}
16
+ declare function StatStrip({ className, variant, row, ...props }: StatStripProps): import("react").JSX.Element;
17
+ type StatStripItemProps = Omit<useRender.ComponentProps<"div">, "children" | "onSelect"> & {
18
+ label: string;
19
+ /** The full name a screen reader hears where `label` shortens it ("Revenue per visitor"). */
20
+ name?: string;
21
+ /**
22
+ * A number (or a string) is formatted with `format`; any other node renders as is.
23
+ */
24
+ value: ReactNode;
25
+ format?: NumberFormat;
26
+ /** A line under the figure: what it counts, or the figure it is compared with. */
27
+ hint?: ReactNode;
28
+ /** Folds the hint line away; keep passing the hint so the line has its text as it closes. */
29
+ hintHidden?: boolean;
30
+ /**
31
+ * Rendered at the end of the label row, e.g. a change against a previous period.
32
+ */
33
+ trend?: ReactNode;
34
+ /** Marks the item as the one driving the panel beside it. */
35
+ selected?: boolean;
36
+ /**
37
+ * Makes the item a toggle button for the panel beside it, pressed while `selected`. Its label
38
+ * and figure stay its name, so a screen reader hears the number with the label.
39
+ */
40
+ onSelect?: () => void;
41
+ };
42
+ declare function StatStripItem({ label, name, value, format, hint, hintHidden, trend, selected, onSelect, render, className, ...props }: StatStripItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
43
+ export { StatStrip, StatStripItem };
@@ -0,0 +1,151 @@
1
+ "use client";
2
+ import { formatIdList } from "../lib/aria.js";
3
+ import { figureClasses } from "../lib/classes.js";
4
+ import { cn, variants } from "../lib/variants.js";
5
+ import { cardSurfaceClasses } from "./card.js";
6
+ import { Collapse } from "./collapse.js";
7
+ import { FormattedNumber } from "./formatted-number.js";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { useRender } from "@base-ui/react/use-render";
10
+ import { isValidElement, useCallback, useId, useLayoutEffect, useRef } from "react";
11
+ // src/components/stat-strip.tsx
12
+ const stripVariants = variants({
13
+ base: ["@container group/strip grid grid-cols-2 max-sm:[&>*:last-child:nth-child(odd)]:col-span-2", "sm:grid-cols-3 sm:[&>*:last-child:nth-child(3n+1)]:col-span-3 sm:[&>*:last-child:nth-child(3n+2)]:col-span-2"],
14
+ variants: {
15
+ variant: {
16
+ plain: cardSurfaceClasses,
17
+ track: ""
18
+ },
19
+ row: {
20
+ lg: "lg:flex lg:flex-wrap",
21
+ wide: "min-[1360px]:flex min-[1360px]:flex-wrap"
22
+ }
23
+ },
24
+ defaultVariants: {
25
+ variant: "plain",
26
+ row: "lg"
27
+ }
28
+ });
29
+ /**
30
+ * Shrinks every figure of the strip by the same factor until the widest one fits its cell, so
31
+ * figures stay one size across the strip and none is cut off. A figure's length depends on the
32
+ * reader's language ("12.6K" in English, "12,6 tys." in Polish), so the fit is measured, not
33
+ * assumed.
34
+ *
35
+ * Text width is proportional to font size, so a figure's full-size width is its width now over
36
+ * the factor now: one pass of reads and at most one write, with no reset to full size and the
37
+ * second layout that would cost on every frame of a window resize. The factor is written only
38
+ * when it changes, and a figure that got shorter grows back.
39
+ */
40
+ function useFigureFit() {
41
+ const ref = useRef(null);
42
+ const fit = useCallback(() => {
43
+ const strip = ref.current;
44
+ if (!strip) return;
45
+ const current = Number(strip.style.getPropertyValue("--stat-fit")) || 1;
46
+ let scale = 1;
47
+ for (const text of strip.querySelectorAll("[data-value] > [data-figure]")) {
48
+ const available = (text.parentElement?.clientWidth ?? 0) - 2;
49
+ const needed = text.getBoundingClientRect().width / current;
50
+ if (needed > available) scale = Math.min(scale, available / needed);
51
+ }
52
+ const next = Math.floor(scale * 100) / 100;
53
+ if (next !== current) strip.style.setProperty("--stat-fit", String(next));
54
+ }, []);
55
+ useLayoutEffect(fit);
56
+ useLayoutEffect(() => {
57
+ const strip = ref.current;
58
+ if (!strip) return;
59
+ let width = 0;
60
+ const observer = new ResizeObserver(([entry]) => {
61
+ if (!entry || entry.contentRect.width === width) return;
62
+ width = entry.contentRect.width;
63
+ fit();
64
+ });
65
+ observer.observe(strip);
66
+ return () => observer.disconnect();
67
+ }, [fit]);
68
+ return ref;
69
+ }
70
+ function StatStrip({ className, variant, row, ...props }) {
71
+ const ref = useFigureFit();
72
+ return /* @__PURE__ */ jsx("div", {
73
+ ref,
74
+ "data-row": row ?? "lg",
75
+ className: stripVariants({
76
+ variant,
77
+ row,
78
+ className
79
+ }),
80
+ ...props
81
+ });
82
+ }
83
+ const valueClasses = cn(figureClasses, "mt-0.5 truncate text-[calc(clamp(1.125rem,8cqw,1.75rem)*var(--stat-fit,1))] leading-figure sm:mt-1", "sm:text-[calc(clamp(1.125rem,5cqw,1.75rem)*var(--stat-fit,1))]", "group-data-[row=lg]/strip:lg:text-[calc(clamp(1.125rem,3.3cqw,1.75rem)*var(--stat-fit,1))]", "group-data-[row=wide]/strip:min-[1360px]:text-[calc(clamp(1.125rem,2.2cqw,1.75rem)*var(--stat-fit,1))]");
84
+ function StatStripItem({ label, name, value, format, hint, hintHidden, trend, selected, onSelect, render, className, ...props }) {
85
+ const id = useId();
86
+ const button = onSelect && /* @__PURE__ */ jsx("button", {
87
+ type: "button",
88
+ "aria-pressed": !!selected,
89
+ "aria-labelledby": `${id}-label ${id}-value`,
90
+ "aria-describedby": formatIdList(!!trend && `${id}-trend`, !!hint && !hintHidden && `${id}-hint`),
91
+ onClick: () => onSelect()
92
+ });
93
+ return useRender({
94
+ render: render ?? button,
95
+ defaultTagName: "div",
96
+ props: {
97
+ "data-selected": selected ? true : void 0,
98
+ className: cn("group/stat relative min-w-0 flex-1 px-[clamp(1rem,2cqw,1.5rem)] py-[clamp(0.75rem,1.5cqw,1.25rem)] text-start", "before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-edge", "first:before:hidden max-sm:[&:nth-child(odd)]:before:hidden", "group-data-[row=lg]/strip:sm:max-lg:[&:nth-child(3n+1)]:before:hidden", "group-data-[row=wide]/strip:sm:max-[1360px]:[&:nth-child(3n+1)]:before:hidden", "after:absolute after:inset-x-0 after:top-0 after:hidden after:h-px after:bg-edge", "max-sm:[&:nth-child(n+3)]:after:block", "group-data-[row=lg]/strip:sm:max-lg:[&:nth-child(n+4)]:after:block", "group-data-[row=wide]/strip:sm:max-[1360px]:[&:nth-child(n+4)]:after:block", "data-selected:[&_[data-label]]:text-ink", "[&:is(button)]:hover:not-data-selected:[&_[data-label]]:text-ink-secondary", "focus-visible:outline-offset-[-2px]", className),
99
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ /* @__PURE__ */ jsx("span", {
101
+ "aria-hidden": true,
102
+ className: cn("absolute inset-x-0 bottom-0 h-0.5 bg-chart-1 opacity-0", onSelect && "group-hover/stat:opacity-35", "group-data-selected/stat:opacity-100!")
103
+ }),
104
+ /* @__PURE__ */ jsxs("p", {
105
+ "data-label": true,
106
+ className: "flex items-baseline justify-between gap-2 text-ink-muted text-sm",
107
+ children: [/* @__PURE__ */ jsx("span", {
108
+ id: `${id}-label`,
109
+ className: "min-w-0 truncate",
110
+ children: name ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
111
+ "aria-hidden": true,
112
+ children: label
113
+ }), /* @__PURE__ */ jsx("span", {
114
+ className: "sr-only",
115
+ children: name
116
+ })] }) : label
117
+ }), trend && /* @__PURE__ */ jsx("span", {
118
+ id: `${id}-trend`,
119
+ className: "shrink-0",
120
+ children: trend
121
+ })]
122
+ }),
123
+ /* @__PURE__ */ jsx("p", {
124
+ id: `${id}-value`,
125
+ "data-value": true,
126
+ className: valueClasses,
127
+ children: /* @__PURE__ */ jsx("span", {
128
+ "data-figure": true,
129
+ children: isValidElement(value) || typeof value !== "number" && typeof value !== "string" ? value : /* @__PURE__ */ jsx(FormattedNumber, {
130
+ value,
131
+ format
132
+ })
133
+ })
134
+ }),
135
+ hint && /* @__PURE__ */ jsx(Collapse, {
136
+ open: !hintHidden,
137
+ className: hintHidden ? "duration-200" : void 0,
138
+ children: /* @__PURE__ */ jsx("p", {
139
+ id: `${id}-hint`,
140
+ className: cn("truncate text-ink-muted text-sm", "transition-[translate,filter] duration-250 ease-out-expo motion-reduce:transition-none", hintHidden && "-translate-y-1.5 blur-[4px]"),
141
+ children: hint
142
+ })
143
+ })
144
+ ] }),
145
+ ...props
146
+ }
147
+ });
148
+ }
149
+ export { StatStrip, StatStripItem };
150
+
151
+ //# sourceMappingURL=stat-strip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat-strip.js","names":[],"sources":["../../src/components/stat-strip.tsx"],"sourcesContent":["\"use client\"\n\nimport { useRender } from \"@base-ui/react/use-render\"\nimport {\n type ComponentProps,\n isValidElement,\n type ReactNode,\n useCallback,\n useLayoutEffect,\n useId,\n useRef,\n} from \"react\"\nimport { formatIdList } from \"../lib/aria\"\nimport { figureClasses } from \"../lib/classes\"\nimport { cn, variants, type VariantProps } from \"../lib/variants\"\nimport { cardSurfaceClasses } from \"./card\"\nimport { Collapse } from \"./collapse\"\nimport { FormattedNumber, type NumberFormat } from \"./formatted-number\"\n\nconst stripVariants = variants({\n // Stacked in a tighter cut (see the item) until there is room for one row: two-up on a\n // phone, three-up from a tablet, then a flex row that fits however many stats there are.\n // A short last row stretches to the strip's edge instead of leaving an empty cell: a lone\n // last tile spans the row on a phone, and at three-up the last tile takes whatever the row\n // has left (four stats read three and one, five read three and two).\n // A container, so a figure can be sized against the whole strip rather than its own cell.\n base: [\n \"@container group/strip grid grid-cols-2 max-sm:[&>*:last-child:nth-child(odd)]:col-span-2\",\n \"sm:grid-cols-3 sm:[&>*:last-child:nth-child(3n+1)]:col-span-3 sm:[&>*:last-child:nth-child(3n+2)]:col-span-2\",\n ],\n\n variants: {\n variant: {\n // A white card of figures on its own, divided by full-height hairlines.\n plain: cardSurfaceClasses,\n // The same row as a band of the card it shares with something else, most often the\n // chart the selected figure draws: no surface of its own, and the panel below it\n // carries the hairline that closes the band.\n track: \"\",\n },\n\n // Where the stacked grid gives way to one row. A cell of that row is the full width over\n // the number of stats, so how early it can happen is the caller's to know. `lg` carries\n // up to four stats, which are comfortable on a laptop. `wide` carries up to six with a\n // change beside each label: a label of about twelve characters plus a percentage holds\n // from 1360px up and clips at `xl`.\n row: {\n lg: \"lg:flex lg:flex-wrap\",\n wide: \"min-[1360px]:flex min-[1360px]:flex-wrap\",\n },\n },\n\n defaultVariants: {\n variant: \"plain\",\n row: \"lg\",\n },\n})\n\n/**\n * Shrinks every figure of the strip by the same factor until the widest one fits its cell, so\n * figures stay one size across the strip and none is cut off. A figure's length depends on the\n * reader's language (\"12.6K\" in English, \"12,6 tys.\" in Polish), so the fit is measured, not\n * assumed.\n *\n * Text width is proportional to font size, so a figure's full-size width is its width now over\n * the factor now: one pass of reads and at most one write, with no reset to full size and the\n * second layout that would cost on every frame of a window resize. The factor is written only\n * when it changes, and a figure that got shorter grows back.\n */\nfunction useFigureFit() {\n const ref = useRef<HTMLDivElement>(null)\n\n const fit = useCallback(() => {\n const strip = ref.current\n if (!strip) return\n\n // `||`, not `??`: an unset property reads as \"\" and so as 0, which means full size.\n const current = Number(strip.style.getPropertyValue(\"--stat-fit\")) || 1\n let scale = 1\n\n // The text's own width against its line's: a truncated line reports no overflow through\n // `scrollWidth`, since the ellipsis is what fills it. The browser truncates a figure that\n // fits to within a pixel, so the line is taken as two pixels narrower than it is.\n for (const text of strip.querySelectorAll<HTMLElement>(\"[data-value] > [data-figure]\")) {\n const available = (text.parentElement?.clientWidth ?? 0) - 2\n const needed = text.getBoundingClientRect().width / current\n if (needed > available) scale = Math.min(scale, available / needed)\n }\n\n // Rounded down, so a figure that fits by a subpixel is not cut off by rounding up.\n const next = Math.floor(scale * 100) / 100\n if (next !== current) strip.style.setProperty(\"--stat-fit\", String(next))\n }, [])\n\n // Every render, since any figure may have changed.\n useLayoutEffect(fit)\n\n // A cell's width follows the strip's, and the layout steps between two-up, three-up and one\n // row. Only a width change refits: the refit itself changes the strip's height. The observer\n // runs after layout, so its reads are free.\n useLayoutEffect(() => {\n const strip = ref.current\n if (!strip) return\n\n let width = 0\n const observer = new ResizeObserver(([entry]) => {\n if (!entry || entry.contentRect.width === width) return\n width = entry.contentRect.width\n fit()\n })\n\n observer.observe(strip)\n return () => observer.disconnect()\n }, [fit])\n\n return ref\n}\n\ninterface StatStripProps\n extends Omit<ComponentProps<\"div\">, \"ref\">, VariantProps<typeof stripVariants> {}\n\nfunction StatStrip({ className, variant, row, ...props }: StatStripProps) {\n const ref = useFigureFit()\n\n return (\n <div\n ref={ref}\n data-row={row ?? \"lg\"}\n className={stripVariants({ variant, row, className })}\n {...props}\n />\n )\n}\n\n// Sized against the strip (`cqw`, the strip being the container) rather than its own cell, so\n// every figure in a strip comes out the same size. The share follows the layout: half the\n// strip per cell while the grid is two-up, a third three-up, and in one row the most cells\n// the row variant carries: a quarter for `lg`, a sixth for `wide`. Measured: ~26px on a\n// phone; in one row, the 28px cap from about 850px of `lg` strip and 1270px of `wide` strip,\n// with the 18px floor never binding. Tabular digits are wider than proportional ones, so the\n// shares are 3.3% and 2.2% and the cap 28: a \"$30.6K\" fits its cell. A longer figure (a\n// language that abbreviates in more letters) scales the whole strip down by `--stat-fit`.\nconst valueClasses = cn(\n // Tabular, so a figure that repolls in place or steps on a range change does not nudge\n // what sits beside it.\n figureClasses,\n \"mt-0.5 truncate text-[calc(clamp(1.125rem,8cqw,1.75rem)*var(--stat-fit,1))] leading-figure sm:mt-1\",\n \"sm:text-[calc(clamp(1.125rem,5cqw,1.75rem)*var(--stat-fit,1))]\",\n \"group-data-[row=lg]/strip:lg:text-[calc(clamp(1.125rem,3.3cqw,1.75rem)*var(--stat-fit,1))]\",\n \"group-data-[row=wide]/strip:min-[1360px]:text-[calc(clamp(1.125rem,2.2cqw,1.75rem)*var(--stat-fit,1))]\",\n)\n\ntype StatStripItemProps = Omit<useRender.ComponentProps<\"div\">, \"children\" | \"onSelect\"> & {\n label: string\n /** The full name a screen reader hears where `label` shortens it (\"Revenue per visitor\"). */\n name?: string\n /**\n * A number (or a string) is formatted with `format`; any other node renders as is.\n */\n value: ReactNode\n format?: NumberFormat\n /** A line under the figure: what it counts, or the figure it is compared with. */\n hint?: ReactNode\n /** Folds the hint line away; keep passing the hint so the line has its text as it closes. */\n hintHidden?: boolean\n /**\n * Rendered at the end of the label row, e.g. a change against a previous period.\n */\n trend?: ReactNode\n /** Marks the item as the one driving the panel beside it. */\n selected?: boolean\n /**\n * Makes the item a toggle button for the panel beside it, pressed while `selected`. Its label\n * and figure stay its name, so a screen reader hears the number with the label.\n */\n onSelect?: () => void\n}\n\nfunction StatStripItem({\n label,\n name,\n value,\n format,\n hint,\n hintHidden,\n trend,\n selected,\n onSelect,\n render,\n className,\n ...props\n}: StatStripItemProps) {\n const id = useId()\n // Named by the label and the figure alone (\"Visitors 1,234\"), so the change and the hint\n // read after them as its description rather than running into the number.\n const button = onSelect && (\n <button\n type=\"button\"\n aria-pressed={!!selected}\n aria-labelledby={`${id}-label ${id}-value`}\n aria-describedby={formatIdList(\n !!trend && `${id}-trend`,\n !!hint && !hintHidden && `${id}-hint`,\n )}\n onClick={() => onSelect()}\n />\n )\n\n return useRender({\n render: render ?? button,\n defaultTagName: \"div\",\n props: {\n \"data-selected\": selected ? true : undefined,\n className: cn(\n // The inset scales with the strip like the figure does, so a cell keeps its proportions\n // from a phone (16/12) up to the full desktop row (24/20).\n \"group/stat relative min-w-0 flex-1 px-[clamp(1rem,2cqw,1.5rem)] py-[clamp(0.75rem,1.5cqw,1.25rem)] text-start\",\n // Hairline divider before every neighbour: between the columns while the strip is\n // stacked, then between the cells of the single row. Hidden on whichever item starts\n // a row, which is every other one at two-up and every third at three-up.\n \"before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-edge\",\n \"first:before:hidden max-sm:[&:nth-child(odd)]:before:hidden\",\n \"group-data-[row=lg]/strip:sm:max-lg:[&:nth-child(3n+1)]:before:hidden\",\n \"group-data-[row=wide]/strip:sm:max-[1360px]:[&:nth-child(3n+1)]:before:hidden\",\n // And one above every row after the first while the strip is stacked: from the third\n // item at two-up, the fourth at three-up. The single row has nothing above it.\n \"after:absolute after:inset-x-0 after:top-0 after:hidden after:h-px after:bg-edge\",\n \"max-sm:[&:nth-child(n+3)]:after:block\",\n \"group-data-[row=lg]/strip:sm:max-lg:[&:nth-child(n+4)]:after:block\",\n \"group-data-[row=wide]/strip:sm:max-[1360px]:[&:nth-child(n+4)]:after:block\",\n // The selected cell carries a 2px bar in the first series colour along its bottom edge,\n // where the chart it picks begins, as a tab marks its panel; the hairlines either side\n // stay. The value is full-strength whichever way; the label is muted until the cell is\n // selected.\n \"data-selected:[&_[data-label]]:text-ink\",\n // A cell other than the selected one answers the pointer as a tab does, with no fill: its\n // label steps up one shade, short of the selected ink, and the bar shows faintly.\n \"[&:is(button)]:hover:not-data-selected:[&_[data-label]]:text-ink-secondary\",\n // A surface that clips would cut a focus outline drawn past a flush cell, so the\n // outline sits inside the cell instead.\n \"focus-visible:outline-offset-[-2px]\",\n className,\n ),\n children: (\n <>\n {/* One bar for both states, so a click on a hovered cell only strengthens it. */}\n <span\n aria-hidden\n className={cn(\n \"absolute inset-x-0 bottom-0 h-0.5 bg-chart-1 opacity-0\",\n onSelect && \"group-hover/stat:opacity-35\",\n \"group-data-selected/stat:opacity-100!\",\n )}\n />\n <p\n data-label\n className=\"flex items-baseline justify-between gap-2 text-ink-muted text-sm\"\n >\n <span id={`${id}-label`} className=\"min-w-0 truncate\">\n {name ? (\n <>\n <span aria-hidden>{label}</span>\n <span className=\"sr-only\">{name}</span>\n </>\n ) : (\n label\n )}\n </span>\n {trend && (\n <span id={`${id}-trend`} className=\"shrink-0\">\n {trend}\n </span>\n )}\n </p>\n\n <p id={`${id}-value`} data-value className={valueClasses}>\n <span data-figure>\n {isValidElement(value) || (typeof value !== \"number\" && typeof value !== \"string\") ? (\n value\n ) : (\n <FormattedNumber value={value} format={format} />\n )}\n </span>\n </p>\n\n {hint && (\n <Collapse open={!hintHidden} className={hintHidden ? \"duration-200\" : undefined}>\n <p\n id={`${id}-hint`}\n className={cn(\n \"truncate text-ink-muted text-sm\",\n \"transition-[translate,filter] duration-250 ease-out-expo motion-reduce:transition-none\",\n hintHidden && \"-translate-y-1.5 blur-[4px]\",\n )}\n >\n {hint}\n </p>\n </Collapse>\n )}\n </>\n ),\n ...props,\n },\n })\n}\n\nexport { StatStrip, StatStripItem }\n"],"mappings":"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"}
@@ -0,0 +1,19 @@
1
+ import { ComponentProps } from "react";
2
+ type StepsProps = ComponentProps<"div"> & {
3
+ /**
4
+ * The step in progress, 1-based. Past `total` every bar reads as done, which is the state
5
+ * a flow ends on: nothing is in progress any more.
6
+ */
7
+ current: number;
8
+ /**
9
+ * The total number of steps.
10
+ */
11
+ total: number;
12
+ };
13
+ /**
14
+ * Segmented progress bars for multi-step flows: a done step is the page's ink, the step in
15
+ * progress is a shade lighter and animates in, and the ones ahead are the hairline colour.
16
+ * Screen readers get "Step n of m", announced again whenever the step changes.
17
+ */
18
+ export declare function Steps({ className, current, total, ...props }: StepsProps): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,25 @@
1
+ import { cn } from "../lib/variants.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/components/steps.tsx
4
+ /**
5
+ * Segmented progress bars for multi-step flows: a done step is the page's ink, the step in
6
+ * progress is a shade lighter and animates in, and the ones ahead are the hairline colour.
7
+ * Screen readers get "Step n of m", announced again whenever the step changes.
8
+ */
9
+ function Steps({ className, current, total, ...props }) {
10
+ return /* @__PURE__ */ jsxs("div", {
11
+ className: cn("flex gap-1.5", className),
12
+ ...props,
13
+ children: [/* @__PURE__ */ jsx("p", {
14
+ "aria-live": "polite",
15
+ className: "sr-only",
16
+ children: current > total ? "All steps complete" : `Step ${current} of ${total}`
17
+ }), Array.from({ length: total }, (_, index) => /* @__PURE__ */ jsx("div", {
18
+ "aria-hidden": true,
19
+ className: cn("h-1 flex-1 rounded-full transition-colors duration-300 ease-out-expo", index < current - 1 && "bg-ink", index === current - 1 && "origin-left animate-fill-bar bg-ink-muted motion-reduce:animate-none", index > current - 1 && "bg-edge")
20
+ }, index))]
21
+ });
22
+ }
23
+ export { Steps };
24
+
25
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","names":[],"sources":["../../src/components/steps.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { cn } from \"../lib/variants\"\n\ntype StepsProps = ComponentProps<\"div\"> & {\n /**\n * The step in progress, 1-based. Past `total` every bar reads as done, which is the state\n * a flow ends on: nothing is in progress any more.\n */\n current: number\n\n /**\n * The total number of steps.\n */\n total: number\n}\n\n/**\n * Segmented progress bars for multi-step flows: a done step is the page's ink, the step in\n * progress is a shade lighter and animates in, and the ones ahead are the hairline colour.\n * Screen readers get \"Step n of m\", announced again whenever the step changes.\n */\nexport function Steps({ className, current, total, ...props }: StepsProps) {\n return (\n <div className={cn(\"flex gap-1.5\", className)} {...props}>\n <p aria-live=\"polite\" className=\"sr-only\">\n {current > total ? \"All steps complete\" : `Step ${current} of ${total}`}\n </p>\n\n {Array.from({ length: total }, (_, index) => (\n <div\n key={index}\n aria-hidden\n className={cn(\n \"h-1 flex-1 rounded-full transition-colors duration-300 ease-out-expo\",\n index < current - 1 && \"bg-ink\",\n index === current - 1 &&\n \"origin-left animate-fill-bar bg-ink-muted motion-reduce:animate-none\",\n index > current - 1 && \"bg-edge\",\n )}\n />\n ))}\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,MAAM,EAAE,WAAW,SAAS,OAAO,GAAG,SAAqB;CACzE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,gBAAgB,SAAS;EAAG,GAAI;EAAnD,UAAA,CACE,oBAAC,KAAD;GAAG,aAAU;GAAS,WAAU;GAC7B,UAAA,UAAU,QAAQ,uBAAuB,QAAQ,QAAQ,MAAM;EAC/D,CAAA,GAEF,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UACjC,oBAAC,OAAD;GAEE,eAAA;GACA,WAAW,GACT,wEACA,QAAQ,UAAU,KAAK,UACvB,UAAU,UAAU,KAClB,wEACF,QAAQ,UAAU,KAAK,SACzB;EACD,GATM,KASN,CACF,CACE;;AAET"}
@@ -0,0 +1,16 @@
1
+ import { Switch as Switch$1 } from "@base-ui/react/switch";
2
+ /**
3
+ * Base UI renders the switch as a `<span role="switch">`, so a disabled one carries
4
+ * `data-disabled` and never matches `:disabled`: the state and hover rules key off the data
5
+ * attribute, and the shared pointer cursor is set here for the same reason.
6
+ *
7
+ * The knob is a raised key inset 2px in the track, a well with no edge of its own, the way the
8
+ * chosen option of a segmented control sits in its row. Both are pills, so the knob's curve
9
+ * follows the track's at any inset.
10
+ * Off, the track is the well and the knob carries the strong edge, which darkens under the
11
+ * pointer as a checkbox's does. On, the track and the knob's edge take the brand, the track at
12
+ * 80% so it sits a shade lighter than the knob's edge. In dark the knob is the lighter part: mid
13
+ * grey on the well, near white on the brand.
14
+ */
15
+ declare function Switch({ className, ...props }: Switch$1.Root.Props): import("react").JSX.Element;
16
+ export { Switch };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { interactiveVariants } from "../lib/interactive.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Switch as Switch$1 } from "@base-ui/react/switch";
6
+ // src/components/switch.tsx
7
+ /**
8
+ * Base UI renders the switch as a `<span role="switch">`, so a disabled one carries
9
+ * `data-disabled` and never matches `:disabled`: the state and hover rules key off the data
10
+ * attribute, and the shared pointer cursor is set here for the same reason.
11
+ *
12
+ * The knob is a raised key inset 2px in the track, a well with no edge of its own, the way the
13
+ * chosen option of a segmented control sits in its row. Both are pills, so the knob's curve
14
+ * follows the track's at any inset.
15
+ * Off, the track is the well and the knob carries the strong edge, which darkens under the
16
+ * pointer as a checkbox's does. On, the track and the knob's edge take the brand, the track at
17
+ * 80% so it sits a shade lighter than the knob's edge. In dark the knob is the lighter part: mid
18
+ * grey on the well, near white on the brand.
19
+ */
20
+ function Switch({ className, ...props }) {
21
+ return /* @__PURE__ */ jsx(Switch$1.Root, {
22
+ className: cn(interactiveVariants({ interactive: false }), "group/switch inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 shadow-well", "data-unchecked:bg-well data-checked:bg-brand/80 aria-invalid:data-unchecked:bg-danger-subtle", "not-data-disabled:not-aria-disabled:cursor-pointer", "data-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50", className),
23
+ ...props,
24
+ children: /* @__PURE__ */ jsx(Switch$1.Thumb, { className: cn("pointer-events-none block size-4 rounded-full border border-edge-strong bg-knob shadow-control transition-[translate,border-color,background-color] duration-200 ease-out-expo", "group-hover/switch:not-data-checked:not-data-disabled:border-edge-solid", "data-checked:translate-x-4 data-checked:border-brand data-checked:bg-knob-on") })
25
+ });
26
+ }
27
+ export { Switch };
28
+
29
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","names":["SwitchPrimitive"],"sources":["../../src/components/switch.tsx"],"sourcesContent":["\"use client\"\n\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { cn } from \"../lib/variants\"\n\n/**\n * Base UI renders the switch as a `<span role=\"switch\">`, so a disabled one carries\n * `data-disabled` and never matches `:disabled`: the state and hover rules key off the data\n * attribute, and the shared pointer cursor is set here for the same reason.\n *\n * The knob is a raised key inset 2px in the track, a well with no edge of its own, the way the\n * chosen option of a segmented control sits in its row. Both are pills, so the knob's curve\n * follows the track's at any inset.\n * Off, the track is the well and the knob carries the strong edge, which darkens under the\n * pointer as a checkbox's does. On, the track and the knob's edge take the brand, the track at\n * 80% so it sits a shade lighter than the knob's edge. In dark the knob is the lighter part: mid\n * grey on the well, near white on the brand.\n */\nfunction Switch({ className, ...props }: SwitchPrimitive.Root.Props) {\n // Merged outside `variants`, which cannot take Base UI's state-function `className`.\n return (\n <SwitchPrimitive.Root\n className={cn(\n interactiveVariants({ interactive: false }),\n \"group/switch inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 shadow-well\",\n \"data-unchecked:bg-well data-checked:bg-brand/80 aria-invalid:data-unchecked:bg-danger-subtle\",\n \"not-data-disabled:not-aria-disabled:cursor-pointer\",\n \"data-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block size-4 rounded-full border border-edge-strong bg-knob shadow-control transition-[translate,border-color,background-color] duration-200 ease-out-expo\",\n \"group-hover/switch:not-data-checked:not-data-disabled:border-edge-solid\",\n \"data-checked:translate-x-4 data-checked:border-brand data-checked:bg-knob-on\",\n )}\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,OAAO,EAAE,WAAW,GAAG,SAAqC;CAEnE,OACE,oBAACA,SAAgB,MAAjB;EACE,WAAW,GACT,oBAAoB,EAAE,aAAa,MAAM,CAAC,GAC1C,yFACA,gGACA,sDACA,sFACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAACA,SAAgB,OAAjB,EACE,WAAW,GACT,kLACA,2EACA,8EACF,EACD,CAAA;CACmB,CAAA;AAE1B"}
@@ -0,0 +1,18 @@
1
+ import { segmentedVariants } from "../lib/segmented.js";
2
+ import { VariantProps } from "../lib/variants.js";
3
+ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
4
+ /**
5
+ * Tabs that switch a panel: each `TabsTrigger` shows its `TabsPanel`, and a screen reader
6
+ * announces the pair. A row that picks a value and shows nothing of its own is a
7
+ * `SegmentedControl`.
8
+ */
9
+ declare const Tabs: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").TabsRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
10
+ /**
11
+ * The content of one tab, rendered while its trigger is active and labelled by it. Give it the
12
+ * `value` of its `TabsTrigger`.
13
+ */
14
+ declare const TabsPanel: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").TabsPanelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
15
+ type TabsListProps = Tabs$1.List.Props & VariantProps<typeof segmentedVariants>;
16
+ declare function TabsList({ className, children, variant, size, ...props }: TabsListProps): import("react").JSX.Element;
17
+ declare const TabsTrigger: import("react").MemoExoticComponent<({ className, ...props }: Tabs$1.Tab.Props) => import("react").JSX.Element>;
18
+ export { Tabs, TabsList, TabsPanel, TabsTrigger };
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { segmentedVariants } from "../lib/segmented.js";
3
+ import { cn } from "../lib/variants.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { createContext, memo, use } from "react";
6
+ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
7
+ // src/components/tabs.tsx
8
+ /**
9
+ * Tabs that switch a panel: each `TabsTrigger` shows its `TabsPanel`, and a screen reader
10
+ * announces the pair. A row that picks a value and shows nothing of its own is a
11
+ * `SegmentedControl`.
12
+ */
13
+ const Tabs = Tabs$1.Root;
14
+ /**
15
+ * The content of one tab, rendered while its trigger is active and labelled by it. Give it the
16
+ * `value` of its `TabsTrigger`.
17
+ */
18
+ const TabsPanel = Tabs$1.Panel;
19
+ const TabsVariantContext = createContext({
20
+ variant: "segmented",
21
+ size: "md"
22
+ });
23
+ /**
24
+ * Sliding highlight that tracks the active tab via Base UI's --active-tab-* CSS variables.
25
+ * Rendered automatically by TabsList, so every tab group shares one pill.
26
+ */
27
+ function TabsIndicator({ className, ...props }) {
28
+ const { variant, size } = use(TabsVariantContext);
29
+ return /* @__PURE__ */ jsx(Tabs$1.Indicator, {
30
+ className: cn(segmentedVariants({
31
+ variant,
32
+ size
33
+ }).indicator(), "h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top)", className),
34
+ ...props
35
+ });
36
+ }
37
+ function TabsList({ className, children, variant = "segmented", size = "md", ...props }) {
38
+ return /* @__PURE__ */ jsx(TabsVariantContext, {
39
+ value: {
40
+ variant,
41
+ size
42
+ },
43
+ children: /* @__PURE__ */ jsxs(Tabs$1.List, {
44
+ className: cn(segmentedVariants({
45
+ variant,
46
+ size
47
+ }).root(), className),
48
+ ...props,
49
+ children: [/* @__PURE__ */ jsx(TabsIndicator, {}), children]
50
+ })
51
+ });
52
+ }
53
+ const TabsTrigger = memo(function TabsTrigger({ className, ...props }) {
54
+ const { variant, size } = use(TabsVariantContext);
55
+ return /* @__PURE__ */ jsx(Tabs$1.Tab, {
56
+ className: cn(segmentedVariants({
57
+ variant,
58
+ size
59
+ }).item(), "not-disabled:cursor-pointer disabled:opacity-50 data-active:text-ink", className),
60
+ ...props
61
+ });
62
+ });
63
+ export { Tabs, TabsList, TabsPanel, TabsTrigger };
64
+
65
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["\"use client\"\n\nimport { Tabs as TabsPrimitive } from \"@base-ui/react/tabs\"\nimport { createContext, memo, use } from \"react\"\nimport { type SegmentedStyle, segmentedVariants } from \"../lib/segmented\"\nimport { cn, type VariantProps } from \"../lib/variants\"\n\n/**\n * Tabs that switch a panel: each `TabsTrigger` shows its `TabsPanel`, and a screen reader\n * announces the pair. A row that picks a value and shows nothing of its own is a\n * `SegmentedControl`.\n */\nconst Tabs = TabsPrimitive.Root\n\n/**\n * The content of one tab, rendered while its trigger is active and labelled by it. Give it the\n * `value` of its `TabsTrigger`.\n */\nconst TabsPanel = TabsPrimitive.Panel\n\n// The parts below merge `className` outside the variants call, unlike everywhere else: Base UI\n// types it as a function of the part's own state too, which `variants` cannot take.\n\nconst TabsVariantContext = createContext<SegmentedStyle>({\n variant: \"segmented\",\n size: \"md\",\n})\n\n/**\n * Sliding highlight that tracks the active tab via Base UI's --active-tab-* CSS variables.\n * Rendered automatically by TabsList, so every tab group shares one pill.\n */\nfunction TabsIndicator({ className, ...props }: TabsPrimitive.Indicator.Props) {\n const { variant, size } = use(TabsVariantContext)\n\n return (\n <TabsPrimitive.Indicator\n className={cn(\n segmentedVariants({ variant, size }).indicator(),\n \"h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top)\",\n className,\n )}\n {...props}\n />\n )\n}\n\ntype TabsListProps = TabsPrimitive.List.Props & VariantProps<typeof segmentedVariants>\n\nfunction TabsList({\n className,\n children,\n variant = \"segmented\",\n size = \"md\",\n ...props\n}: TabsListProps) {\n return (\n <TabsVariantContext value={{ variant, size }}>\n <TabsPrimitive.List\n className={cn(segmentedVariants({ variant, size }).root(), className)}\n {...props}\n >\n <TabsIndicator />\n {children}\n </TabsPrimitive.List>\n </TabsVariantContext>\n )\n}\n\n// Memoised: a tab row re-renders with its card, and its triggers rarely change with it.\nconst TabsTrigger = memo(function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {\n const { variant, size } = use(TabsVariantContext)\n\n return (\n <TabsPrimitive.Tab\n className={cn(\n segmentedVariants({ variant, size }).item(),\n \"not-disabled:cursor-pointer disabled:opacity-50 data-active:text-ink\",\n className,\n )}\n {...props}\n />\n )\n})\n\nexport { Tabs, TabsList, TabsPanel, TabsTrigger }\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,OAAOA,OAAc;;;;;AAM3B,MAAM,YAAYA,OAAc;AAKhC,MAAM,qBAAqB,cAA8B;CACvD,SAAS;CACT,MAAM;AACR,CAAC;;;;;AAMD,SAAS,cAAc,EAAE,WAAW,GAAG,SAAwC;CAC7E,MAAM,EAAE,SAAS,SAAS,IAAI,kBAAkB;CAEhD,OACE,oBAACA,OAAc,WAAf;EACE,WAAW,GACT,kBAAkB;GAAE;GAAS;EAAK,CAAC,CAAC,CAAC,UAAU,GAC/C,iHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,SAAS,EAChB,WACA,UACA,UAAU,aACV,OAAO,MACP,GAAG,SACa;CAChB,OACE,oBAAC,oBAAD;EAAoB,OAAO;GAAE;GAAS;EAAK;EACzC,UAAA,qBAACA,OAAc,MAAf;GACE,WAAW,GAAG,kBAAkB;IAAE;IAAS;GAAK,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS;GACpE,GAAI;GAFN,UAAA,CAIE,oBAAC,eAAD,CAAgB,CAAA,GACf,QACiB;;CACF,CAAA;AAExB;AAGA,MAAM,cAAc,KAAK,SAAS,YAAY,EAAE,WAAW,GAAG,SAAkC;CAC9F,MAAM,EAAE,SAAS,SAAS,IAAI,kBAAkB;CAEhD,OACE,oBAACA,OAAc,KAAf;EACE,WAAW,GACT,kBAAkB;GAAE;GAAS;EAAK,CAAC,CAAC,CAAC,KAAK,GAC1C,wEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ declare const textLinkVariants: import("tailwind-variants").TVReturnType<{
4
+ tone: {
5
+ brand: string;
6
+ muted: string;
7
+ };
8
+ }, undefined, "underline decoration-1 underline-offset-3 decoration-current/40 transition-[text-decoration-color] duration-150 ease-out hover:decoration-current", undefined, undefined, undefined>;
9
+ export interface TextLinkProps extends useRender.ComponentProps<"a">, VariantProps<typeof textLinkVariants> {}
10
+ /**
11
+ * A link inside running text: a sentence in a description, a callout or an empty state. It
12
+ * sets colour and underline and nothing else, so it wraps with the words around it and reads
13
+ * at their size. A standalone control beside prose is `InlineAction` or `Button` instead.
14
+ */
15
+ declare function TextLink({ className, tone, render, ...props }: TextLinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
16
+ export { TextLink };
@@ -0,0 +1,32 @@
1
+ import { variants } from "../lib/variants.js";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ // src/components/text-link.tsx
4
+ const textLinkVariants = variants({
5
+ base: "underline decoration-1 underline-offset-3 decoration-current/40 transition-[text-decoration-color] duration-150 ease-out hover:decoration-current",
6
+ variants: { tone: {
7
+ brand: "text-brand-ink",
8
+ muted: ""
9
+ } },
10
+ defaultVariants: { tone: "brand" }
11
+ });
12
+ /**
13
+ * A link inside running text: a sentence in a description, a callout or an empty state. It
14
+ * sets colour and underline and nothing else, so it wraps with the words around it and reads
15
+ * at their size. A standalone control beside prose is `InlineAction` or `Button` instead.
16
+ */
17
+ function TextLink({ className, tone, render, ...props }) {
18
+ return useRender({
19
+ render,
20
+ defaultTagName: "a",
21
+ props: {
22
+ className: textLinkVariants({
23
+ tone,
24
+ className
25
+ }),
26
+ ...props
27
+ }
28
+ });
29
+ }
30
+ export { TextLink };
31
+
32
+ //# sourceMappingURL=text-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-link.js","names":[],"sources":["../../src/components/text-link.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst textLinkVariants = variants({\n // Underlined in every tone, because a link inside a sentence has no shape of its own to mark\n // it: colour alone fails for a reader who cannot separate the two hues. The 1px rule sits 3px\n // down, clear of the descenders, in the link's colour at 40%, and turns solid under the pointer.\n base: \"underline decoration-1 underline-offset-3 decoration-current/40 transition-[text-decoration-color] duration-150 ease-out hover:decoration-current\",\n\n variants: {\n tone: {\n brand: \"text-brand-ink\",\n // Takes the sentence's colour, for fine print that should not draw the eye.\n muted: \"\",\n },\n },\n\n defaultVariants: {\n tone: \"brand\",\n },\n})\n\nexport interface TextLinkProps\n extends useRender.ComponentProps<\"a\">, VariantProps<typeof textLinkVariants> {}\n\n/**\n * A link inside running text: a sentence in a description, a callout or an empty state. It\n * sets colour and underline and nothing else, so it wraps with the words around it and reads\n * at their size. A standalone control beside prose is `InlineAction` or `Button` instead.\n */\nfunction TextLink({ className, tone, render, ...props }: TextLinkProps) {\n return useRender({\n render,\n defaultTagName: \"a\",\n props: { className: textLinkVariants({ tone, className }), ...props },\n })\n}\n\nexport { TextLink }\n"],"mappings":";;;AAGA,MAAM,mBAAmB,SAAS;CAIhC,MAAM;CAEN,UAAU,EACR,MAAM;EACJ,OAAO;EAEP,OAAO;CACT,EACF;CAEA,iBAAiB,EACf,MAAM,QACR;AACF,CAAC;;;;;;AAUD,SAAS,SAAS,EAAE,WAAW,MAAM,QAAQ,GAAG,SAAwB;CACtE,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GAAE,WAAW,iBAAiB;IAAE;IAAM;GAAU,CAAC;GAAG,GAAG;EAAM;CACtE,CAAC;AACH"}
@@ -0,0 +1,10 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { PasswordManagerProps, inputVariants } from "./input.js";
3
+ import { ComponentProps } from "react";
4
+ type TextareaProps = Omit<ComponentProps<"textarea">, "size"> & VariantProps<typeof inputVariants> & PasswordManagerProps;
5
+ /**
6
+ * A multi-line field that grows with its text up to 320px, then scrolls. A browser without
7
+ * `field-sizing` keeps the `rows` height and scrolls from there.
8
+ */
9
+ declare function Textarea({ className, interactive, bordered, size, allowPasswordManager, ...props }: TextareaProps): import("react").JSX.Element;
10
+ export { Textarea };
@@ -0,0 +1,23 @@
1
+ import { cn } from "../lib/variants.js";
2
+ import { inputVariants, passwordManagerAttributes } from "./input.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/textarea.tsx
5
+ /**
6
+ * A multi-line field that grows with its text up to 320px, then scrolls. A browser without
7
+ * `field-sizing` keeps the `rows` height and scrolls from there.
8
+ */
9
+ function Textarea({ className, interactive, bordered, size, allowPasswordManager, ...props }) {
10
+ return /* @__PURE__ */ jsx("textarea", {
11
+ className: inputVariants({
12
+ interactive,
13
+ bordered,
14
+ size,
15
+ className: cn("max-h-80 overflow-y-auto text-copy resize-none field-sizing-content", className)
16
+ }),
17
+ ...passwordManagerAttributes(allowPasswordManager),
18
+ ...props
19
+ });
20
+ }
21
+ export { Textarea };
22
+
23
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","names":[],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { cn, type VariantProps } from \"../lib/variants\"\nimport { inputVariants, passwordManagerAttributes, type PasswordManagerProps } from \"./input\"\n\ntype TextareaProps = Omit<ComponentProps<\"textarea\">, \"size\"> &\n VariantProps<typeof inputVariants> &\n PasswordManagerProps\n\n/**\n * A multi-line field that grows with its text up to 320px, then scrolls. A browser without\n * `field-sizing` keeps the `rows` height and scrolls from there.\n */\nfunction Textarea({\n className,\n interactive,\n bordered,\n size,\n allowPasswordManager,\n ...props\n}: TextareaProps) {\n return (\n <textarea\n className={inputVariants({\n interactive,\n bordered,\n size,\n className: cn(\n \"max-h-80 overflow-y-auto text-copy resize-none field-sizing-content\",\n className,\n ),\n })}\n {...passwordManagerAttributes(allowPasswordManager)}\n {...props}\n />\n )\n}\n\nexport { Textarea }\n"],"mappings":";;;;;;;;AAYA,SAAS,SAAS,EAChB,WACA,aACA,UACA,MACA,sBACA,GAAG,SACa;CAChB,OACE,oBAAC,YAAD;EACE,WAAW,cAAc;GACvB;GACA;GACA;GACA,WAAW,GACT,uEACA,SACF;EACF,CAAC;EACD,GAAI,0BAA0B,oBAAoB;EAClD,GAAI;CACL,CAAA;AAEL"}
@@ -0,0 +1,28 @@
1
+ import { SegmentedControlProps } from "./segmented-control.js";
2
+ export type Theme = "system" | "light" | "dark";
3
+ /**
4
+ * The current theme and its setter. Persists to `localStorage["theme"]`, stays in sync across
5
+ * tabs, and drives the stylesheet's `light-dark()` tokens by setting `data-theme` on `<html>`
6
+ * (`system` removes it so the OS decides). SSR-safe: the server renders `system`.
7
+ *
8
+ * The hook only applies the stored theme once the first subscriber mounts. To avoid a flash of
9
+ * the wrong scheme, apply it before first paint with this inline script in `<head>`:
10
+ *
11
+ * ```html
12
+ * <script>try{var t=localStorage.theme;if(t==="light"||t==="dark")document.documentElement.dataset.theme=t}catch(e){}</script>
13
+ * ```
14
+ */
15
+ export declare function useTheme(): [Theme, (theme: Theme) => void];
16
+ interface ThemeSelectProps extends Omit<SegmentedControlProps<Theme>, "value" | "defaultValue" | "onValueChange" | "variant" | "size"> {
17
+ /**
18
+ * The smallest track with one icon per theme, for a menu row where the labelled control
19
+ * would not fit.
20
+ */
21
+ compact?: boolean;
22
+ }
23
+ /**
24
+ * Segmented System / Light / Dark control bound to `useTheme`, for a settings page or an
25
+ * account menu.
26
+ */
27
+ export declare function ThemeSelect({ compact, ...props }: ThemeSelectProps): import("react").JSX.Element;
28
+ export {};