@underpin/ui 0.0.0 → 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 (259) 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/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 +110 -3
  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
  259. package/publish.log +0 -1
@@ -0,0 +1,204 @@
1
+ import { ArrowUpRightIcon } from "../lib/icons.js";
2
+ import { cn } from "../lib/variants.js";
3
+ import { FormattedNumber } from "./formatted-number.js";
4
+ import { Skeleton } from "./skeleton.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/bar-list.tsx
7
+ /**
8
+ * Ranked breakdown list: each row is a label sitting on a soft bar whose width is the row's
9
+ * share of the largest value, measured across the whole row, with the figures right-aligned
10
+ * beside it. It is a real `<table>` on auto layout, so every figure column is exactly as wide
11
+ * as its own widest cell (its column name included) rather than every column sharing one
12
+ * width cut to fit the longest name. Compose it as `BarList` → `BarList.Header` +
13
+ * `BarList.Body` (or `BarList.Skeleton`), so the names and the figures share the columns.
14
+ *
15
+ * A row that links out carries its `href` on the arrow beside the label; a row-sized click
16
+ * target (click-to-filter) goes in the row's `overlay`, since a `<tr>` can be neither.
17
+ *
18
+ * The bar and the overlay span the row but hang off the label cell, not the `<tr>`: Safari
19
+ * never made a positioned table row a containing block (WebKit 240961), so anything absolute
20
+ * inside one lands on the nearest positioned ancestor outside the table (the card), and every
21
+ * row's bar ran the card's full height and painted over the rows above it. A cell is honoured
22
+ * everywhere, and the wrapper is a container so `100cqw` is the table's width, which is what
23
+ * a share of the row measures against.
24
+ */
25
+ function BarListRoot({ className, ...props }) {
26
+ return /* @__PURE__ */ jsx("div", {
27
+ className: cn("@container -mx-2 -my-1", className),
28
+ children: /* @__PURE__ */ jsx("table", {
29
+ className: "w-full border-separate border-spacing-y-1",
30
+ ...props
31
+ })
32
+ });
33
+ }
34
+ /**
35
+ * The label column takes every pixel the figure columns leave (`w-full`) and may shrink below
36
+ * its own text (`max-w-0`), so a long name truncates instead of widening the table. It is the
37
+ * positioned box the bar and the overlay are laid out against (see `BarListRoot`).
38
+ */
39
+ const labelCellClasses = "relative w-full max-w-0 pl-2";
40
+ /** Laid out from the label cell's left edge across the whole row, whatever the column count. */
41
+ const rowSpanClasses = "absolute inset-y-0 left-0 w-[100cqw]";
42
+ /**
43
+ * The gutter before a figure column. Content-sized columns sit as close as their own digits
44
+ * allow, so the gutter is what keeps four of them from reading as one number.
45
+ */
46
+ const figureGutter = "pl-4";
47
+ /**
48
+ * A figure column is at least 64px, so the columns of two cards side by side line up, and
49
+ * grows with its contents past that. `relative` lifts the figure over the bar, which reaches
50
+ * across from the label cell; that also puts it above a row-sized `overlay`, which is why the
51
+ * overlay carries a z-index.
52
+ */
53
+ const figureCellClasses = cn(figureGutter, "relative min-w-16 text-right whitespace-nowrap tabular-nums");
54
+ /** The rightmost column carries the row's padding at the end of the row. */
55
+ const lastCellClasses = "pr-2";
56
+ function BarListRow({ label, name, icon, value, max, share: shareOverride, format, secondaryValue, secondaryFormat, secondaryClassName, extras, href, overlay, className, style, ...props }) {
57
+ const share = Math.min(Math.max(shareOverride ?? (max > 0 ? value / max : 0), 0), 1);
58
+ return /* @__PURE__ */ jsxs("tr", {
59
+ className: cn("group/bar h-7.5 text-start text-sm", className),
60
+ style: {
61
+ "--bar-share": share,
62
+ ...style
63
+ },
64
+ ...props,
65
+ children: [
66
+ /* @__PURE__ */ jsxs("td", {
67
+ className: labelCellClasses,
68
+ children: [
69
+ /* @__PURE__ */ jsx("div", {
70
+ "aria-hidden": true,
71
+ "data-bar": true,
72
+ className: "absolute inset-y-0 left-0 w-[100cqw] bg-fill-subtle transition-[clip-path] duration-250 ease-out-expo [clip-path:inset(0_calc(100%-max(var(--bar-share)*100%,0.375rem))_0_0_round_var(--radius-md))]"
73
+ }),
74
+ /* @__PURE__ */ jsxs("div", {
75
+ className: "relative flex items-center gap-2",
76
+ children: [
77
+ icon && /* @__PURE__ */ jsx("span", {
78
+ className: "flex size-4 shrink-0 items-center justify-center",
79
+ children: icon
80
+ }),
81
+ /* @__PURE__ */ jsx("span", {
82
+ title: name ?? (typeof label === "string" ? label : void 0),
83
+ className: "min-w-0 truncate",
84
+ children: label
85
+ }),
86
+ href && /* @__PURE__ */ jsx("a", {
87
+ href,
88
+ target: "_blank",
89
+ rel: "noreferrer",
90
+ "data-row-link": true,
91
+ "aria-label": `Open ${name ?? (typeof label === "string" ? label : "this row")} in a new tab`,
92
+ className: "relative z-10 -ml-[3px] flex size-5 shrink-0 items-center justify-center rounded-sm text-ink-muted hover:text-ink pointer-coarse:-mx-1 pointer-coarse:size-7",
93
+ children: /* @__PURE__ */ jsx(ArrowUpRightIcon, { className: "size-3.5" })
94
+ })
95
+ ]
96
+ }),
97
+ overlay
98
+ ]
99
+ }),
100
+ secondaryValue !== void 0 && /* @__PURE__ */ jsx("td", {
101
+ className: cn(figureCellClasses, "text-ink-muted", secondaryClassName),
102
+ children: /* @__PURE__ */ jsx(FormattedNumber, {
103
+ value: secondaryValue,
104
+ format: secondaryFormat
105
+ })
106
+ }),
107
+ extras?.map((extra, index) => /* @__PURE__ */ jsx("td", {
108
+ className: cn(figureCellClasses, "text-ink-muted", extra.className),
109
+ children: extra.value
110
+ }, index)),
111
+ /* @__PURE__ */ jsx("td", {
112
+ className: cn(figureCellClasses, lastCellClasses, "font-medium text-ink-muted"),
113
+ children: /* @__PURE__ */ jsx(FormattedNumber, {
114
+ value,
115
+ format
116
+ })
117
+ })
118
+ ]
119
+ });
120
+ }
121
+ /**
122
+ * Holds the `BarList.Row`s, next to the `BarList.Header` that names their columns.
123
+ */
124
+ function BarListBody(props) {
125
+ return /* @__PURE__ */ jsx("tbody", { ...props });
126
+ }
127
+ /**
128
+ * Column names over a `BarList`, in the rows' own columns: the table lines them up, and each
129
+ * name is free to be as wide as it needs. Keep it inside the same `BarList` as whatever swaps
130
+ * the rows for their skeleton, and the card keeps one height across loading and loaded; drop
131
+ * the whole table for an empty or error state, or the names stand over nothing.
132
+ */
133
+ function BarListHeader({ extras, secondary, value, sticky, className, ...props }) {
134
+ const stickyClasses = sticky && "sticky top-0 z-20 bg-surface";
135
+ const cellClasses = cn(figureGutter, "pb-2 text-right font-normal whitespace-nowrap", stickyClasses);
136
+ return /* @__PURE__ */ jsx("thead", {
137
+ className: cn("text-ink-muted text-xs", className),
138
+ ...props,
139
+ children: /* @__PURE__ */ jsxs("tr", { children: [
140
+ /* @__PURE__ */ jsx("td", { className: cn(labelCellClasses, stickyClasses) }),
141
+ secondary !== void 0 && /* @__PURE__ */ jsx("th", {
142
+ className: cellClasses,
143
+ children: secondary
144
+ }),
145
+ extras?.map((extra, index) => /* @__PURE__ */ jsx("th", {
146
+ className: cn(cellClasses, extra.className),
147
+ children: extra.label
148
+ }, index)),
149
+ /* @__PURE__ */ jsx("th", {
150
+ className: cn(cellClasses, lastCellClasses),
151
+ children: value
152
+ })
153
+ ] })
154
+ });
155
+ }
156
+ /**
157
+ * Label bars step down like a ranked list would, so the swap to data reads as a fill-in
158
+ * rather than a reflow.
159
+ */
160
+ const skeletonShares = [
161
+ "70cqw",
162
+ "55cqw",
163
+ "45cqw",
164
+ "35cqw",
165
+ "30cqw"
166
+ ];
167
+ /**
168
+ * Loading stand-in at the exact row height of `BarList.Row`, so swapping in data causes no
169
+ * layout shift. Its bars take `Skeleton`'s own fill, a step darker than a row's, so the pulse
170
+ * still reads on a card.
171
+ */
172
+ function BarListSkeleton({ rows = 5, columns = 2, className, ...props }) {
173
+ return /* @__PURE__ */ jsx("tbody", {
174
+ "aria-hidden": true,
175
+ className,
176
+ ...props,
177
+ children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("tr", {
178
+ className: "h-7.5",
179
+ children: [
180
+ /* @__PURE__ */ jsx("td", {
181
+ className: labelCellClasses,
182
+ children: /* @__PURE__ */ jsx(Skeleton, {
183
+ className: "absolute inset-y-0 left-0",
184
+ style: { width: skeletonShares[index % skeletonShares.length] }
185
+ })
186
+ }),
187
+ Array.from({ length: Math.max(columns - 2, 0) }, (_, column) => /* @__PURE__ */ jsx("td", { "aria-hidden": true }, column)),
188
+ columns > 1 && /* @__PURE__ */ jsx("td", {
189
+ className: cn(figureCellClasses, lastCellClasses),
190
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-3.5 w-8" })
191
+ })
192
+ ]
193
+ }, index))
194
+ });
195
+ }
196
+ const BarList = Object.assign(BarListRoot, {
197
+ Row: BarListRow,
198
+ Body: BarListBody,
199
+ Header: BarListHeader,
200
+ Skeleton: BarListSkeleton
201
+ });
202
+ export { BarList, rowSpanClasses };
203
+
204
+ //# sourceMappingURL=bar-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar-list.js","names":[],"sources":["../../src/components/bar-list.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties, ReactNode } from \"react\"\nimport { ArrowUpRightIcon } from \"../lib/icons\"\nimport { cn } from \"../lib/variants\"\nimport { FormattedNumber, type NumberFormat } from \"./formatted-number\"\nimport { Skeleton } from \"./skeleton\"\n\n/**\n * Ranked breakdown list: each row is a label sitting on a soft bar whose width is the row's\n * share of the largest value, measured across the whole row, with the figures right-aligned\n * beside it. It is a real `<table>` on auto layout, so every figure column is exactly as wide\n * as its own widest cell (its column name included) rather than every column sharing one\n * width cut to fit the longest name. Compose it as `BarList` → `BarList.Header` +\n * `BarList.Body` (or `BarList.Skeleton`), so the names and the figures share the columns.\n *\n * A row that links out carries its `href` on the arrow beside the label; a row-sized click\n * target (click-to-filter) goes in the row's `overlay`, since a `<tr>` can be neither.\n *\n * The bar and the overlay span the row but hang off the label cell, not the `<tr>`: Safari\n * never made a positioned table row a containing block (WebKit 240961), so anything absolute\n * inside one lands on the nearest positioned ancestor outside the table (the card), and every\n * row's bar ran the card's full height and painted over the rows above it. A cell is honoured\n * everywhere, and the wrapper is a container so `100cqw` is the table's width, which is what\n * a share of the row measures against.\n */\nfunction BarListRoot({ className, ...props }: ComponentProps<\"table\">) {\n return (\n // `border-spacing-y` is the row gap; it also pads the table's top and bottom edge, which\n // `-my-1` takes back. `-mx-2` is the row's own cell padding, so the text sits on the\n // parent's inset and the bar bleeds 8px past it. The margins ride the wrapper: a container\n // is its own formatting context, so a margin on the table would not collapse through it.\n <div className={cn(\"@container -mx-2 -my-1\", className)}>\n <table className=\"w-full border-separate border-spacing-y-1\" {...props} />\n </div>\n )\n}\n\n/**\n * The label column takes every pixel the figure columns leave (`w-full`) and may shrink below\n * its own text (`max-w-0`), so a long name truncates instead of widening the table. It is the\n * positioned box the bar and the overlay are laid out against (see `BarListRoot`).\n */\nconst labelCellClasses = \"relative w-full max-w-0 pl-2\"\n\n/** Laid out from the label cell's left edge across the whole row, whatever the column count. */\nexport const rowSpanClasses = \"absolute inset-y-0 left-0 w-[100cqw]\"\n\n/**\n * The gutter before a figure column. Content-sized columns sit as close as their own digits\n * allow, so the gutter is what keeps four of them from reading as one number.\n */\nconst figureGutter = \"pl-4\"\n\n/**\n * A figure column is at least 64px, so the columns of two cards side by side line up, and\n * grows with its contents past that. `relative` lifts the figure over the bar, which reaches\n * across from the label cell; that also puts it above a row-sized `overlay`, which is why the\n * overlay carries a z-index.\n */\nconst figureCellClasses = cn(\n figureGutter,\n \"relative min-w-16 text-right whitespace-nowrap tabular-nums\",\n)\n\n/** The rightmost column carries the row's padding at the end of the row. */\nconst lastCellClasses = \"pr-2\"\n\nexport type BarListRowProps = Omit<ComponentProps<\"tr\">, \"children\"> & {\n /**\n * Row text; string labels truncate.\n */\n label: ReactNode\n /**\n * Plain-text row name for the link's aria label, when `label` isn't a string.\n */\n name?: string\n /**\n * Leading visual (favicon, flag, icon tile), 16px.\n */\n icon?: ReactNode\n value: number\n /**\n * The largest value in the list; the bar spans `value / max` of the row.\n */\n max: number\n /**\n * Bar width as a fraction of the row, overriding `value / max`: e.g. a rank ladder so the\n * bars hold still while the rows' labels and values change under them.\n */\n share?: number\n format?: NumberFormat\n /**\n * The figure that leads the row (revenue, a conversion rate), in the column right after the\n * label: the same place on a card and in the full list beside it.\n */\n secondaryValue?: number | string\n secondaryFormat?: NumberFormat\n /** Styles the secondary figure, e.g. tinting money apart from the counts around it. */\n secondaryClassName?: string\n /**\n * Further muted figures in their own columns between the secondary one and the value, for\n * a wide list (a dialog) that has room for figures the card holds back.\n */\n extras?: { value: ReactNode; className?: string }[]\n /**\n * External URL, shown as an arrow beside the label that opens in a new tab.\n */\n href?: string\n /**\n * An element laid over the whole row, such as a click-to-filter button. It renders inside the\n * label cell, which positions it; give it `rowSpanClasses` to cover every column. Give it a\n * `z-index`: the figure cells are positioned and come after it, so at `z-auto` they would\n * paint over it and swallow every click outside the label. Keep it under the `href` arrow's\n * `z-10` and the arrow stays clickable above it.\n */\n overlay?: ReactNode\n}\n\nfunction BarListRow({\n label,\n name,\n icon,\n value,\n max,\n share: shareOverride,\n format,\n secondaryValue,\n secondaryFormat,\n secondaryClassName,\n extras,\n href,\n overlay,\n className,\n style,\n ...props\n}: BarListRowProps) {\n // Clamped at both ends. The low end guards a negative value and the divide by zero; the\n // high end guards a `share` override above 1, or a `max` computed from a filtered subset\n // while `value` comes from the full set. The bar is absolutely positioned, so it would\n // run past the row's right edge and under the value column.\n const share = Math.min(Math.max(shareOverride ?? (max > 0 ? value / max : 0), 0), 1)\n\n return (\n <tr\n className={cn(\"group/bar h-7.5 text-start text-sm\", className)}\n style={{ \"--bar-share\": share, ...style } as CSSProperties}\n {...props}\n >\n <td className={labelCellClasses}>\n {/* The bar spans the whole row, so a 100% share runs edge to edge behind label and\n value alike; the text sits above it. A clip draws the share, since a list changes\n every bar at once and animating their widths would lay the rows out on each frame. */}\n <div\n aria-hidden\n data-bar\n className=\"absolute inset-y-0 left-0 w-[100cqw] bg-fill-subtle transition-[clip-path] duration-250 ease-out-expo [clip-path:inset(0_calc(100%-max(var(--bar-share)*100%,0.375rem))_0_0_round_var(--radius-md))]\"\n />\n\n <div className=\"relative flex items-center gap-2\">\n {icon && <span className=\"flex size-4 shrink-0 items-center justify-center\">{icon}</span>}\n {/* A truncated label has no other full reading: the row has no tooltip, and the\n details dialog truncates the same way. */}\n <span\n title={name ?? (typeof label === \"string\" ? label : undefined)}\n className=\"min-w-0 truncate\"\n >\n {label}\n </span>\n\n {href && (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-row-link\n aria-label={`Open ${name ?? (typeof label === \"string\" ? label : \"this row\")} in a new tab`}\n // Its own flex item, never inside the label: a truncating label would clip\n // the arrow away. `z-10` keeps it clickable under a row-sized `overlay`\n // (click-to-filter); a coarse pointer gets a target grown around the glyph,\n // with the negative margin keeping the row's layout. The -3px takes back the\n // inset its click target leaves around a 14px glyph, so the arrow sits the same\n // 8px off the label as the icon does on the other side.\n className=\"relative z-10 -ml-[3px] flex size-5 shrink-0 items-center justify-center rounded-sm text-ink-muted hover:text-ink pointer-coarse:-mx-1 pointer-coarse:size-7\"\n >\n <ArrowUpRightIcon className=\"size-3.5\" />\n </a>\n )}\n </div>\n\n {overlay}\n </td>\n\n {secondaryValue !== undefined && (\n <td className={cn(figureCellClasses, \"text-ink-muted\", secondaryClassName)}>\n <FormattedNumber value={secondaryValue} format={secondaryFormat} />\n </td>\n )}\n\n {extras?.map((extra, index) => (\n <td key={index} className={cn(figureCellClasses, \"text-ink-muted\", extra.className)}>\n {extra.value}\n </td>\n ))}\n\n <td className={cn(figureCellClasses, lastCellClasses, \"font-medium text-ink-muted\")}>\n <FormattedNumber value={value} format={format} />\n </td>\n </tr>\n )\n}\n\nexport type BarListBodyProps = ComponentProps<\"tbody\">\n\n/**\n * Holds the `BarList.Row`s, next to the `BarList.Header` that names their columns.\n */\nfunction BarListBody(props: BarListBodyProps) {\n return <tbody {...props} />\n}\n\nexport type BarListHeaderProps = Omit<ComponentProps<\"thead\">, \"children\"> & {\n /**\n * Names the rows' `extras` columns, in the same order.\n */\n extras?: { label: ReactNode; className?: string }[]\n /**\n * Names the secondary column; leave it out when no row fills that column.\n */\n secondary?: ReactNode\n value: ReactNode\n /**\n * Pin the names to the top of the nearest scroll container, for a list long enough to scroll\n * (the full list in a dialog), so the figures stay named however far down you are. Give the\n * scroll container no top padding: the names then start where they stick and never move.\n */\n sticky?: boolean\n}\n\n/**\n * Column names over a `BarList`, in the rows' own columns: the table lines them up, and each\n * name is free to be as wide as it needs. Keep it inside the same `BarList` as whatever swaps\n * the rows for their skeleton, and the card keeps one height across loading and loaded; drop\n * the whole table for an empty or error state, or the names stand over nothing.\n */\nfunction BarListHeader({\n extras,\n secondary,\n value,\n sticky,\n className,\n ...props\n}: BarListHeaderProps) {\n // Sticky rides the cells, not the `<thead>`: a table section only sticks in newer browsers,\n // and each cell has to carry the background itself: `border-separate` leaves gaps a\n // section-level background never paints, which the rows would show through. A sticky\n // element is held inside its scroll container's padding, so padding there would leave a band\n // over the names that the rows pass through; the room above belongs outside the container.\n // `z-20`, over the rows' `z-10` arrows: at the same z, later in the DOM, they paint over it.\n const stickyClasses = sticky && \"sticky top-0 z-20 bg-surface\"\n // No top padding: the parent's padding is the room over the names. 8px plus the row gap\n // puts the first bar 12px under them, matching the 12px above.\n const cellClasses = cn(\n figureGutter,\n \"pb-2 text-right font-normal whitespace-nowrap\",\n stickyClasses,\n )\n\n return (\n <thead className={cn(\"text-ink-muted text-xs\", className)} {...props}>\n <tr>\n {/* The label column goes unnamed (the card's title and tab already say what the\n rows are), so its corner is a plain cell holding the column open, not a header\n of nothing. It stays in the accessibility tree: a hidden cell in a header row can\n shift which header a screen reader pairs with each column. */}\n {/* oxlint-disable-next-line jsx-a11y/control-has-associated-label */}\n <td className={cn(labelCellClasses, stickyClasses)} />\n {secondary !== undefined && <th className={cellClasses}>{secondary}</th>}\n {extras?.map((extra, index) => (\n <th key={index} className={cn(cellClasses, extra.className)}>\n {extra.label}\n </th>\n ))}\n <th className={cn(cellClasses, lastCellClasses)}>{value}</th>\n </tr>\n </thead>\n )\n}\n\n/**\n * Label bars step down like a ranked list would, so the swap to data reads as a fill-in\n * rather than a reflow.\n */\nconst skeletonShares = [\"70cqw\", \"55cqw\", \"45cqw\", \"35cqw\", \"30cqw\"] as const\n\nexport type BarListSkeletonProps = ComponentProps<\"tbody\"> & {\n /**\n * Rows to draw, matching the list that replaces it.\n */\n rows?: number\n /**\n * Columns the list has, the label one included, so the one figure the skeleton draws lands\n * under the same name the data's will.\n */\n columns?: number\n}\n\n/**\n * Loading stand-in at the exact row height of `BarList.Row`, so swapping in data causes no\n * layout shift. Its bars take `Skeleton`'s own fill, a step darker than a row's, so the pulse\n * still reads on a card.\n */\nfunction BarListSkeleton({ rows = 5, columns = 2, className, ...props }: BarListSkeletonProps) {\n return (\n <tbody aria-hidden className={className} {...props}>\n {Array.from({ length: rows }, (_, index) => (\n <tr key={index} className=\"h-7.5\">\n <td className={labelCellClasses}>\n <Skeleton\n className=\"absolute inset-y-0 left-0\"\n style={{ width: skeletonShares[index % skeletonShares.length] }}\n />\n </td>\n {/* Placeholders for the columns between the label and the last figure. They carry no\n padding of their own, so a column its header hides on a narrow screen collapses\n to nothing here too. */}\n {Array.from({ length: Math.max(columns - 2, 0) }, (_, column) => (\n <td key={column} aria-hidden />\n ))}\n {columns > 1 && (\n <td className={cn(figureCellClasses, lastCellClasses)}>\n <Skeleton className=\"ml-auto h-3.5 w-8\" />\n </td>\n )}\n </tr>\n ))}\n </tbody>\n )\n}\n\nconst BarList = Object.assign(BarListRoot, {\n Row: BarListRow,\n Body: BarListBody,\n Header: BarListHeader,\n Skeleton: BarListSkeleton,\n})\n\nexport { BarList }\n"],"mappings":"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"}
@@ -0,0 +1,30 @@
1
+ import { Card } from "./card.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+ export type BreakdownCardProps = Omit<ComponentProps<typeof Card>, "title"> & {
4
+ title: ReactNode;
5
+ description?: ReactNode;
6
+ /**
7
+ * Header actions, right-aligned beside the title (a menu, a time-range control).
8
+ */
9
+ actions?: ReactNode;
10
+ /**
11
+ * A view switcher (e.g. `ViewPicker`) pinned to the top of the body, above the children.
12
+ */
13
+ tabs?: ReactNode;
14
+ /**
15
+ * A compact hairline-topped strip under the body, for a "Details" link or a total. It sets
16
+ * the small type scale every footer control and note reads at, so its content passes no
17
+ * size of its own.
18
+ */
19
+ footer?: ReactNode;
20
+ /**
21
+ * Drop the body panel's padding, for a body that draws its own edges (a divided row list).
22
+ */
23
+ flush?: boolean;
24
+ };
25
+ /**
26
+ * A dashboard panel: a titled header panel above a flex body panel, hairline-divided, with an
27
+ * optional footer strip. The body grows to fill the card so panels in the same row keep an
28
+ * even height.
29
+ */
30
+ export declare function BreakdownCard({ title, description, actions, tabs, footer, flush, children, ...props }: BreakdownCardProps): import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { cn } from "../lib/variants.js";
2
+ import { Card, CardHeader, CardPanel } from "./card.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/breakdown-card.tsx
5
+ /**
6
+ * A dashboard panel: a titled header panel above a flex body panel, hairline-divided, with an
7
+ * optional footer strip. The body grows to fill the card so panels in the same row keep an
8
+ * even height.
9
+ */
10
+ function BreakdownCard({ title, description, actions, tabs, footer, flush, children, ...props }) {
11
+ return /* @__PURE__ */ jsxs(Card, {
12
+ ...props,
13
+ children: [
14
+ /* @__PURE__ */ jsx(CardPanel, {
15
+ size: "none",
16
+ className: "px-4 py-3 md:px-5 md:py-3.5",
17
+ children: /* @__PURE__ */ jsx(CardHeader, {
18
+ size: "panel",
19
+ className: "flex-nowrap gap-y-0.5 [&>*:first-child]:flex-none",
20
+ title,
21
+ description,
22
+ actions
23
+ })
24
+ }),
25
+ /* @__PURE__ */ jsxs(CardPanel, {
26
+ size: "none",
27
+ className: cn("flex flex-1 flex-col gap-3 px-4 py-3 md:px-5", flush && "p-0 md:p-0"),
28
+ children: [tabs && /* @__PURE__ */ jsx("div", {
29
+ className: cn("flex", flush && "px-4 pt-4"),
30
+ children: tabs
31
+ }), children]
32
+ }),
33
+ footer && /* @__PURE__ */ jsx(CardPanel, {
34
+ size: "none",
35
+ className: "px-4 py-3 text-xs/5 md:px-5",
36
+ children: footer
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ export { BreakdownCard };
42
+
43
+ //# sourceMappingURL=breakdown-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakdown-card.js","names":[],"sources":["../../src/components/breakdown-card.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\"\nimport { cn } from \"../lib/variants\"\nimport { Card, CardHeader, CardPanel } from \"./card\"\n\n// `title` is omitted before it is redeclared: a `<div>`'s own `title` attribute is a string,\n// and the intersection would otherwise narrow the card's heading to one.\nexport type BreakdownCardProps = Omit<ComponentProps<typeof Card>, \"title\"> & {\n title: ReactNode\n description?: ReactNode\n /**\n * Header actions, right-aligned beside the title (a menu, a time-range control).\n */\n actions?: ReactNode\n /**\n * A view switcher (e.g. `ViewPicker`) pinned to the top of the body, above the children.\n */\n tabs?: ReactNode\n /**\n * A compact hairline-topped strip under the body, for a \"Details\" link or a total. It sets\n * the small type scale every footer control and note reads at, so its content passes no\n * size of its own.\n */\n footer?: ReactNode\n /**\n * Drop the body panel's padding, for a body that draws its own edges (a divided row list).\n */\n flush?: boolean\n}\n\n/**\n * A dashboard panel: a titled header panel above a flex body panel, hairline-divided, with an\n * optional footer strip. The body grows to fill the card so panels in the same row keep an\n * even height.\n */\nexport function BreakdownCard({\n title,\n description,\n actions,\n tabs,\n footer,\n flush,\n children,\n ...props\n}: BreakdownCardProps) {\n return (\n <Card {...props}>\n <CardPanel size=\"none\" className=\"px-4 py-3 md:px-5 md:py-3.5\">\n <CardHeader\n size=\"panel\"\n // The actions keep the title's line and wrap within the space left beside it, rather\n // than dropping under the title the moment they no longer fit on one row: a card's\n // tab row is the usual actions here, and it has its own wrapping.\n className=\"flex-nowrap gap-y-0.5 [&>*:first-child]:flex-none\"\n title={title}\n description={description}\n actions={actions}\n />\n </CardPanel>\n\n {/* The header's inset, so row text starts under the title and figures end under the\n actions; `BarList` bleeds its bars past that line. 12px over and under the list. */}\n <CardPanel\n size=\"none\"\n // `md:p-0` alongside `p-0`: the merge treats a variant class as its own group, so\n // `p-0` on its own leaves `md:px-5` standing and a flush body is only flush on a phone.\n className={cn(\"flex flex-1 flex-col gap-3 px-4 py-3 md:px-5\", flush && \"p-0 md:p-0\")}\n >\n {tabs && <div className={cn(\"flex\", flush && \"px-4 pt-4\")}>{tabs}</div>}\n {children}\n </CardPanel>\n\n {/* A fixed band: 12px over a 20px line and 12px under it, whatever the body is showing.\n The line is `text-xs/5`, not the 16px one this size carries by default, so the band\n is 44px for a footer that passes plain text as much as for one that pins its own row. */}\n {footer && (\n <CardPanel size=\"none\" className=\"px-4 py-3 text-xs/5 md:px-5\">\n {footer}\n </CardPanel>\n )}\n </Card>\n )\n}\n"],"mappings":";;;;;;;;;AAkCA,SAAgB,cAAc,EAC5B,OACA,aACA,SACA,MACA,QACA,OACA,UACA,GAAG,SACkB;CACrB,OACE,qBAAC,MAAD;EAAM,GAAI;EAAV,UAAA;GACE,oBAAC,WAAD;IAAW,MAAK;IAAO,WAAU;IAC/B,UAAA,oBAAC,YAAD;KACE,MAAK;KAIL,WAAU;KACH;KACM;KACJ;IACV,CAAA;GACQ,CAAA;GAIX,qBAAC,WAAD;IACE,MAAK;IAGL,WAAW,GAAG,gDAAgD,SAAS,YAAY;IAJrF,UAAA,CAMG,QAAQ,oBAAC,OAAD;KAAK,WAAW,GAAG,QAAQ,SAAS,WAAW;KAAI,UAAA;IAAU,CAAA,GACrE,QACQ;;GAKV,UACC,oBAAC,WAAD;IAAW,MAAK;IAAO,WAAU;IAC9B,UAAA;GACQ,CAAA;EAET;;AAEV"}
@@ -0,0 +1,17 @@
1
+ import { ComponentProps } from "react";
2
+ /**
3
+ * Buttons joined into one control. Each member keeps its own border and the group draws
4
+ * nothing: every member after the first drops its left border, so the edge of the one before it
5
+ * is the divider. Edges are translucent, so two borders laid over each other would draw a darker
6
+ * seam. The inner corners square off. Meant for bordered (`secondary`) buttons. A hovered, open
7
+ * or focused member is lifted above its neighbours, so its focus outline runs round all four
8
+ * sides. A pressed member stays in line, since a 1px drop would step it out of the group, and
9
+ * darkens instead.
10
+ *
11
+ * The ends are found among the members, not the children: an open popup trigger gets
12
+ * focus-guard and `aria-owns` spans rendered beside it, a member under `DisabledReason` a
13
+ * `hidden` reason, and `:first-child` would move off the button onto one of those. A guard is
14
+ * matched by its `data-base-ui-focus-guard` attribute, not `aria-hidden`: in Safari, Base UI
15
+ * gives it `role="button"` in place of `aria-hidden`, for VoiceOver.
16
+ */
17
+ export declare function ButtonGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { cn } from "../lib/variants.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/components/button-group.tsx
4
+ /**
5
+ * Buttons joined into one control. Each member keeps its own border and the group draws
6
+ * nothing: every member after the first drops its left border, so the edge of the one before it
7
+ * is the divider. Edges are translucent, so two borders laid over each other would draw a darker
8
+ * seam. The inner corners square off. Meant for bordered (`secondary`) buttons. A hovered, open
9
+ * or focused member is lifted above its neighbours, so its focus outline runs round all four
10
+ * sides. A pressed member stays in line, since a 1px drop would step it out of the group, and
11
+ * darkens instead.
12
+ *
13
+ * The ends are found among the members, not the children: an open popup trigger gets
14
+ * focus-guard and `aria-owns` spans rendered beside it, a member under `DisabledReason` a
15
+ * `hidden` reason, and `:first-child` would move off the button onto one of those. A guard is
16
+ * matched by its `data-base-ui-focus-guard` attribute, not `aria-hidden`: in Safari, Base UI
17
+ * gives it `role="button"` in place of `aria-hidden`, for VoiceOver.
18
+ */
19
+ function ButtonGroup({ className, ...props }) {
20
+ return /* @__PURE__ */ jsx("div", {
21
+ className: cn("inline-flex [&>*]:relative [&>*]:rounded-none", "[&>*]:active:translate-y-0! [&>:not([aria-disabled=true])]:active:bg-fill!", "[&>*:hover]:z-10 [&>*:focus-visible]:z-10 [&>*[data-popup-open]]:z-10", "[&>:nth-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden]))]:rounded-l-md", "[&>:nth-last-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden]))]:rounded-r-md", "[&>:not(:nth-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden])))]:border-l-0", className),
22
+ ...props
23
+ });
24
+ }
25
+ export { ButtonGroup };
26
+
27
+ //# sourceMappingURL=button-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-group.js","names":[],"sources":["../../src/components/button-group.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { cn } from \"../lib/variants\"\n\n/**\n * Buttons joined into one control. Each member keeps its own border and the group draws\n * nothing: every member after the first drops its left border, so the edge of the one before it\n * is the divider. Edges are translucent, so two borders laid over each other would draw a darker\n * seam. The inner corners square off. Meant for bordered (`secondary`) buttons. A hovered, open\n * or focused member is lifted above its neighbours, so its focus outline runs round all four\n * sides. A pressed member stays in line, since a 1px drop would step it out of the group, and\n * darkens instead.\n *\n * The ends are found among the members, not the children: an open popup trigger gets\n * focus-guard and `aria-owns` spans rendered beside it, a member under `DisabledReason` a\n * `hidden` reason, and `:first-child` would move off the button onto one of those. A guard is\n * matched by its `data-base-ui-focus-guard` attribute, not `aria-hidden`: in Safari, Base UI\n * gives it `role=\"button\"` in place of `aria-hidden`, for VoiceOver.\n */\nexport function ButtonGroup({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"inline-flex [&>*]:relative [&>*]:rounded-none\",\n \"[&>*]:active:translate-y-0! [&>:not([aria-disabled=true])]:active:bg-fill!\",\n \"[&>*:hover]:z-10 [&>*:focus-visible]:z-10 [&>*[data-popup-open]]:z-10\",\n \"[&>:nth-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden]))]:rounded-l-md\",\n \"[&>:nth-last-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden]))]:rounded-r-md\",\n \"[&>:not(:nth-child(1_of_:not([data-base-ui-focus-guard]):not([aria-owns]):not([hidden])))]:border-l-0\",\n className,\n )}\n {...props}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAY,EAAE,WAAW,GAAG,SAAgC;CAC1E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,iDACA,8EACA,yEACA,qGACA,0GACA,yGACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
@@ -0,0 +1,39 @@
1
+ import { VariantProps } from "../lib/variants.js";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import { ReactNode } from "react";
4
+ declare const buttonVariants: import("tailwind-variants").TVReturnType<{
5
+ variant: {
6
+ primary: string;
7
+ secondary: string;
8
+ soft: string;
9
+ ghost: string;
10
+ };
11
+ tone: {
12
+ neutral: string;
13
+ danger: string;
14
+ };
15
+ bordered: {
16
+ true: string;
17
+ };
18
+ size: {
19
+ xs: string;
20
+ sm: string;
21
+ md: string;
22
+ lg: string;
23
+ };
24
+ interactive: {
25
+ true: string;
26
+ };
27
+ }, undefined, string[], undefined, undefined, undefined>;
28
+ export type ButtonProps = Omit<useRender.ComponentProps<"button">, "size" | "prefix"> & VariantProps<typeof buttonVariants> & {
29
+ /**
30
+ * If set to `true`, the button will be rendered in the pending state.
31
+ */
32
+ isPending?: boolean;
33
+ /** The slot to be rendered before the label. */
34
+ prefix?: ReactNode;
35
+ /** The slot to be rendered after the label. */
36
+ suffix?: ReactNode;
37
+ };
38
+ declare function Button({ children, className, disabled, render, isPending, prefix, suffix, variant, tone, size, interactive, bordered, ...rest }: ButtonProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
39
+ export { Button, buttonVariants };
@@ -0,0 +1,128 @@
1
+ import { LoadingIcon } from "../lib/icons.js";
2
+ import { interactiveVariants } from "../lib/interactive.js";
3
+ import { slot } from "../lib/slot.js";
4
+ import { cn, variants } from "../lib/variants.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { mergeProps } from "@base-ui/react";
7
+ import { useRender } from "@base-ui/react/use-render";
8
+ import { Children, isValidElement } from "react";
9
+ // src/components/button.tsx
10
+ const buttonInteractiveClasses = interactiveVariants({ interactive: false });
11
+ const buttonVariants = variants({
12
+ base: [
13
+ buttonInteractiveClasses,
14
+ "group/button inline-flex items-center justify-center font-medium text-start rounded-md hover:z-10",
15
+ "text-control",
16
+ "disabled:opacity-50 aria-disabled:opacity-50 data-pending:disabled:opacity-100",
17
+ "relative transition-[color,background-color,border-color,box-shadow,opacity,translate] duration-150 ease-out-expo"
18
+ ],
19
+ variants: {
20
+ variant: {
21
+ primary: "bg-ink text-ink-inverse shadow-control aria-expanded:bg-ink/90 aria-expanded:shadow-none",
22
+ secondary: "bg-surface text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink",
23
+ soft: "bg-fill text-ink-secondary aria-expanded:bg-fill-strong aria-expanded:text-ink",
24
+ ghost: "text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink"
25
+ },
26
+ tone: {
27
+ neutral: "",
28
+ danger: ""
29
+ },
30
+ bordered: { true: "border border-edge-strong shadow-control aria-expanded:border-edge-solid aria-expanded:shadow-none" },
31
+ size: {
32
+ xs: "h-6 px-2 gap-1 text-xs rounded",
33
+ sm: "h-7 px-2 gap-1.5",
34
+ md: "h-control px-3 gap-1.5",
35
+ lg: "h-9 px-3.5 gap-2 text-sm rounded-lg"
36
+ },
37
+ interactive: { true: "not-disabled:not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed active:not-disabled:not-aria-disabled:translate-y-px active:not-disabled:not-aria-disabled:shadow-none active:not-disabled:not-aria-disabled:duration-75 active:not-disabled:not-aria-disabled:after:absolute active:not-disabled:not-aria-disabled:after:inset-x-0 active:not-disabled:not-aria-disabled:after:-top-0.5 active:not-disabled:not-aria-disabled:after:h-0.5" }
38
+ },
39
+ compoundVariants: [
40
+ {
41
+ variant: "primary",
42
+ class: ["not-data-pending:disabled:bg-fill not-data-pending:disabled:text-ink-muted not-data-pending:disabled:shadow-none not-data-pending:disabled:opacity-100", "aria-disabled:bg-fill aria-disabled:text-ink-muted aria-disabled:shadow-none aria-disabled:opacity-100"]
43
+ },
44
+ {
45
+ variant: "primary",
46
+ interactive: true,
47
+ class: "hover:not-aria-disabled:bg-ink/90"
48
+ },
49
+ {
50
+ variant: ["secondary", "ghost"],
51
+ interactive: true,
52
+ class: "hover:not-aria-disabled:bg-fill-subtle hover:not-aria-disabled:text-ink"
53
+ },
54
+ {
55
+ bordered: true,
56
+ interactive: true,
57
+ class: "hover:not-aria-disabled:border-edge-solid"
58
+ },
59
+ {
60
+ variant: "soft",
61
+ interactive: true,
62
+ class: "hover:not-aria-disabled:bg-fill-strong hover:not-aria-disabled:text-ink"
63
+ },
64
+ {
65
+ variant: "primary",
66
+ tone: "danger",
67
+ class: "bg-danger text-danger-on hover:not-aria-disabled:bg-danger/90 aria-expanded:bg-danger/90"
68
+ },
69
+ {
70
+ variant: [
71
+ "secondary",
72
+ "soft",
73
+ "ghost"
74
+ ],
75
+ tone: "danger",
76
+ class: "text-danger-ink hover:not-aria-disabled:text-danger-ink aria-expanded:text-danger-ink"
77
+ }
78
+ ],
79
+ defaultVariants: {
80
+ variant: "primary",
81
+ tone: "neutral",
82
+ size: "md",
83
+ interactive: true
84
+ }
85
+ });
86
+ const buttonAffixClasses = "shrink-0 first:-ml-0.5 last:-mr-0.5 [svg]:size-3.5";
87
+ const buttonSquareClasses = "px-0 aspect-square";
88
+ const buttonSquareAffixClasses = "shrink-0 [svg]:size-3.5";
89
+ /**
90
+ * Hidden while a button with no leading icon is pending, so only the spinner reads as content. A
91
+ * button with one keeps its label, since the spinner takes the icon's place.
92
+ */
93
+ const buttonPendingClasses = "group-data-pending/button:text-transparent";
94
+ function Button({ children, className, disabled = false, render, isPending, prefix, suffix, variant, tone, size, interactive = true, bordered, ...rest }) {
95
+ const square = Children.toArray(children).length === 0;
96
+ const affixClasses = square ? buttonSquareAffixClasses : buttonAffixClasses;
97
+ const props = mergeProps({
98
+ disabled: disabled || isPending,
99
+ "aria-busy": isPending ? true : void 0,
100
+ className: buttonVariants({
101
+ variant,
102
+ tone,
103
+ size,
104
+ interactive,
105
+ bordered: bordered ?? variant === "secondary",
106
+ className: cn(square && buttonSquareClasses, className)
107
+ }),
108
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ slot(prefix && isPending ? /* @__PURE__ */ jsx(LoadingIcon, { className: "animate-spin" }) : prefix, { className: affixClasses }),
110
+ !square && slot(isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children }), { className: cn("flex-1 truncate only:flex-initial has-[div]:contents", !prefix && buttonPendingClasses) }),
111
+ slot(suffix, { className: cn(affixClasses, buttonPendingClasses) }),
112
+ !prefix && !!isPending && /* @__PURE__ */ jsx(LoadingIcon, { className: "absolute size-[1.25em] animate-spin" })
113
+ ] })
114
+ }, rest);
115
+ return useRender({
116
+ defaultTagName: "button",
117
+ render,
118
+ props: {
119
+ "data-pending": isPending ? true : void 0,
120
+ "data-pressable": interactive ? "" : void 0,
121
+ ...!render && { type: "button" },
122
+ ...props
123
+ }
124
+ });
125
+ }
126
+ export { Button, buttonVariants };
127
+
128
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../src/components/button.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { Children, isValidElement, type ReactNode } from \"react\"\nimport { LoadingIcon } from \"../lib/icons\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { slot } from \"../lib/slot\"\nimport { cn, variants, type VariantProps } from \"../lib/variants\"\n\n// The shared chrome without its edge or cursor, which the button gates on its own variants.\nconst buttonInteractiveClasses = interactiveVariants({ interactive: false })\n\nconst buttonVariants = variants({\n base: [\n buttonInteractiveClasses,\n \"group/button inline-flex items-center justify-center font-medium text-start rounded-md hover:z-10\",\n \"text-control\",\n \"disabled:opacity-50 aria-disabled:opacity-50 data-pending:disabled:opacity-100\",\n \"relative transition-[color,background-color,border-color,box-shadow,opacity,translate] duration-150 ease-out-expo\",\n ],\n\n variants: {\n variant: {\n // The open look holds while the button's menu or popover is open (Base UI sets the\n // trigger's `aria-expanded`), so the trigger reads as the thing that opened it. Not\n // `data-popup-open`: a tooltip sets that too, and a button would look open under its tooltip.\n // The same look on hover rides `interactive`, below.\n primary:\n \"bg-ink text-ink-inverse shadow-control aria-expanded:bg-ink/90 aria-expanded:shadow-none\",\n secondary:\n \"bg-surface text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink\",\n soft: \"bg-fill text-ink-secondary aria-expanded:bg-fill-strong aria-expanded:text-ink\",\n ghost: \"text-ink-secondary aria-expanded:bg-fill-subtle aria-expanded:text-ink\",\n },\n // What the action means, apart from how loud it is. Danger is for a loss: a primary danger\n // button confirms one, a secondary danger button starts one from a page.\n tone: {\n neutral: \"\",\n danger: \"\",\n },\n bordered: {\n true: \"border border-edge-strong shadow-control aria-expanded:border-edge-solid aria-expanded:shadow-none\",\n },\n // A fixed height and no vertical padding, so a button lines up with the inputs, pickers\n // and triggers beside it whatever it holds: the control scale in `styles.css`.\n size: {\n xs: \"h-6 px-2 gap-1 text-xs rounded\",\n sm: \"h-7 px-2 gap-1.5\",\n md: \"h-control px-3 gap-1.5\",\n lg: \"h-9 px-3.5 gap-2 text-sm rounded-lg\",\n },\n interactive: {\n // A press sets the button down: it drops 1px and loses its shadow, as a card does. A fixed\n // 1px, so a wide button moves as far as a small one, and a move rather than a scale, which\n // would re-rasterise the label on every frame. It goes down at twice the speed it comes\n // back. The `::after` strip stays over the row the button left, or a press on its top pixel\n // would release outside it and lose the click. Rides `interactive`: a disabled control does\n // not answer.\n true: \"not-disabled:not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed active:not-disabled:not-aria-disabled:translate-y-px active:not-disabled:not-aria-disabled:shadow-none active:not-disabled:not-aria-disabled:duration-75 active:not-disabled:not-aria-disabled:after:absolute active:not-disabled:not-aria-disabled:after:inset-x-0 active:not-disabled:not-aria-disabled:after:-top-0.5 active:not-disabled:not-aria-disabled:after:h-0.5\",\n },\n },\n\n compoundVariants: [\n // A disabled primary button goes flat and grey rather than fading: ink at half strength\n // reads as a dimmed slab, while the fill reads as a button that is not ready yet. A pending\n // one keeps its colour, since it is busy rather than unavailable.\n {\n variant: \"primary\",\n class: [\n \"not-data-pending:disabled:bg-fill not-data-pending:disabled:text-ink-muted not-data-pending:disabled:shadow-none not-data-pending:disabled:opacity-100\",\n \"aria-disabled:bg-fill aria-disabled:text-ink-muted aria-disabled:shadow-none aria-disabled:opacity-100\",\n ],\n },\n // Only a button that does something answers the pointer. A reading drawn as a button, with\n // `interactive` off, keeps its resting look under the cursor.\n {\n variant: \"primary\",\n interactive: true,\n class: \"hover:not-aria-disabled:bg-ink/90\",\n },\n {\n variant: [\"secondary\", \"ghost\"],\n interactive: true,\n class: \"hover:not-aria-disabled:bg-fill-subtle hover:not-aria-disabled:text-ink\",\n },\n // A bordered button's edge darkens under the pointer, as a field's and a checkbox's do.\n {\n bordered: true,\n interactive: true,\n class: \"hover:not-aria-disabled:border-edge-solid\",\n },\n {\n variant: \"soft\",\n interactive: true,\n class: \"hover:not-aria-disabled:bg-fill-strong hover:not-aria-disabled:text-ink\",\n },\n {\n variant: \"primary\",\n tone: \"danger\",\n class:\n \"bg-danger text-danger-on hover:not-aria-disabled:bg-danger/90 aria-expanded:bg-danger/90\",\n },\n {\n variant: [\"secondary\", \"soft\", \"ghost\"],\n tone: \"danger\",\n class:\n \"text-danger-ink hover:not-aria-disabled:text-danger-ink aria-expanded:text-danger-ink\",\n },\n ],\n\n defaultVariants: {\n variant: \"primary\",\n tone: \"neutral\",\n size: \"md\",\n interactive: true,\n },\n})\n\n// A 14px icon, drawn 2px closer to the edge than the text is.\nconst buttonAffixClasses = \"shrink-0 first:-ml-0.5 last:-mr-0.5 [svg]:size-3.5\"\n// Nothing but an icon: a square of the button's height, the icon centred in it.\nconst buttonSquareClasses = \"px-0 aspect-square\"\nconst buttonSquareAffixClasses = \"shrink-0 [svg]:size-3.5\"\n\n/**\n * Hidden while a button with no leading icon is pending, so only the spinner reads as content. A\n * button with one keeps its label, since the spinner takes the icon's place.\n */\nconst buttonPendingClasses = \"group-data-pending/button:text-transparent\"\n\nexport type ButtonProps = Omit<useRender.ComponentProps<\"button\">, \"size\" | \"prefix\"> &\n VariantProps<typeof buttonVariants> & {\n /**\n * If set to `true`, the button will be rendered in the pending state.\n */\n isPending?: boolean\n\n /** The slot to be rendered before the label. */\n prefix?: ReactNode\n\n /** The slot to be rendered after the label. */\n suffix?: ReactNode\n }\n\nfunction Button({\n children,\n className,\n disabled = false,\n render,\n isPending,\n prefix,\n suffix,\n variant,\n tone,\n size,\n interactive = true,\n bordered,\n ...rest\n}: ButtonProps) {\n // `toArray` drops `false` and `null`, so a label hidden with `{wide && \"Label\"}` leaves an\n // icon-only button, square and with nothing beside its icon.\n const square = Children.toArray(children).length === 0\n const affixClasses = square ? buttonSquareAffixClasses : buttonAffixClasses\n const props = mergeProps<\"button\">(\n {\n disabled: disabled || isPending,\n \"aria-busy\": isPending ? true : undefined,\n className: buttonVariants({\n variant,\n tone,\n size,\n interactive,\n bordered: bordered ?? variant === \"secondary\",\n className: cn(square && buttonSquareClasses, className),\n }),\n children: (\n <>\n {slot(prefix && isPending ? <LoadingIcon className=\"animate-spin\" /> : prefix, {\n className: affixClasses,\n })}\n\n {/* Beside an affix the label fills the row and pushes the suffix to the end. Alone it\n keeps its own width, so the button's `justify-*` places it: centred by default,\n at the start for a `justify-start` row. */}\n {!square &&\n slot(isValidElement(children) ? children : <span>{children}</span>, {\n className: cn(\n \"flex-1 truncate only:flex-initial has-[div]:contents\",\n !prefix && buttonPendingClasses,\n ),\n })}\n\n {slot(suffix, { className: cn(affixClasses, buttonPendingClasses) })}\n\n {!prefix && !!isPending && (\n <LoadingIcon className=\"absolute size-[1.25em] animate-spin\" />\n )}\n </>\n ),\n },\n rest,\n )\n\n // `data-pending` drives the label and suffix fade; it sits outside `mergeProps`, whose\n // button props type has no room for a custom data attribute.\n //\n // `type` defaults to \"button\", not HTML's \"submit\": a Button inside a <form> that never\n // meant to submit it (a dialog's X, a search field's clear) otherwise does. Callers that\n // want a submit still say so: `props` spreads last and wins. Only applied when the\n // element really is a <button>, since `type` means something else on an <a> or a <label>.\n const isButton = !render\n\n return useRender({\n defaultTagName: \"button\",\n render,\n props: {\n \"data-pending\": isPending ? true : undefined,\n \"data-pressable\": interactive ? \"\" : undefined,\n ...(isButton && { type: \"button\" }),\n ...props,\n },\n })\n}\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;;;AASA,MAAM,2BAA2B,oBAAoB,EAAE,aAAa,MAAM,CAAC;AAE3E,MAAM,iBAAiB,SAAS;CAC9B,MAAM;EACJ;EACA;EACA;EACA;EACA;CACF;CAEA,UAAU;EACR,SAAS;GAKP,SACE;GACF,WACE;GACF,MAAM;GACN,OAAO;EACT;EAGA,MAAM;GACJ,SAAS;GACT,QAAQ;EACV;EACA,UAAU,EACR,MAAM,qGACR;EAGA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,aAAa,EAOX,MAAM,4bACR;CACF;CAEA,kBAAkB;EAIhB;GACE,SAAS;GACT,OAAO,CACL,0JACA,wGACF;EACF;EAGA;GACE,SAAS;GACT,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS,CAAC,aAAa,OAAO;GAC9B,aAAa;GACb,OAAO;EACT;EAEA;GACE,UAAU;GACV,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS;GACT,aAAa;GACb,OAAO;EACT;EACA;GACE,SAAS;GACT,MAAM;GACN,OACE;EACJ;EACA;GACE,SAAS;IAAC;IAAa;IAAQ;GAAO;GACtC,MAAM;GACN,OACE;EACJ;CACF;CAEA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,MAAM;EACN,aAAa;CACf;AACF,CAAC;AAGD,MAAM,qBAAqB;AAE3B,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;;;;;AAMjC,MAAM,uBAAuB;AAgB7B,SAAS,OAAO,EACd,UACA,WACA,WAAW,OACX,QACA,WACA,QACA,QACA,SACA,MACA,MACA,cAAc,MACd,UACA,GAAG,QACW;CAGd,MAAM,SAAS,SAAS,QAAQ,QAAQ,CAAC,CAAC,WAAW;CACrD,MAAM,eAAe,SAAS,2BAA2B;CACzD,MAAM,QAAQ,WACZ;EACE,UAAU,YAAY;EACtB,aAAa,YAAY,OAAO,KAAA;EAChC,WAAW,eAAe;GACxB;GACA;GACA;GACA;GACA,UAAU,YAAY,YAAY;GAClC,WAAW,GAAG,UAAU,qBAAqB,SAAS;EACxD,CAAC;EACD,UACE,qBAAA,UAAA,EAAA,UAAA;GACG,KAAK,UAAU,YAAY,oBAAC,aAAD,EAAa,WAAU,eAAgB,CAAA,IAAI,QAAQ,EAC7E,WAAW,aACb,CAAC;GAKA,CAAC,UACA,KAAK,eAAe,QAAQ,IAAI,WAAW,oBAAC,QAAD,EAAO,SAAe,CAAA,GAAG,EAClE,WAAW,GACT,wDACA,CAAC,UAAU,oBACb,EACF,CAAC;GAEF,KAAK,QAAQ,EAAE,WAAW,GAAG,cAAc,oBAAoB,EAAE,CAAC;GAElE,CAAC,UAAU,CAAC,CAAC,aACZ,oBAAC,aAAD,EAAa,WAAU,sCAAuC,CAAA;EAEhE,EAAA,CAAA;CAEN,GACA,IACF;CAWA,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,gBAAgB,YAAY,OAAO,KAAA;GACnC,kBAAkB,cAAc,KAAK,KAAA;GACrC,GAAI,CARU,UAQE,EAAE,MAAM,SAAS;GACjC,GAAG;EACL;CACF,CAAC;AACH"}
@@ -0,0 +1,27 @@
1
+ import { DateRange as CalendarRange, DayPickerProps } from "react-day-picker";
2
+ /**
3
+ * `ref` and `initialFocus` for the popover or dialog holding a `Calendar`: focus lands on the
4
+ * day react-day-picker marks as its keyboard entry point, so arrow keys move between days at
5
+ * once. Base UI otherwise focuses the back arrow, and react-day-picker's own `autoFocus` does
6
+ * not fire once Base UI has taken focus.
7
+ */
8
+ export declare function useCalendarFocus(): {
9
+ ref: import("react").RefObject<HTMLDivElement | null>;
10
+ initialFocus: () => HTMLElement | null;
11
+ };
12
+ export type CalendarProps = DayPickerProps & {
13
+ /**
14
+ * Spread the month across its container instead of sizing it to the day cells. For a single
15
+ * month filling a phone-width sheet, where a grid sized to 32px cells leaves a wide margin
16
+ * either side. Days grow with the columns, which also gives them a thumb-sized target.
17
+ */
18
+ fluid?: boolean;
19
+ };
20
+ /**
21
+ * A month grid: one date, several, or a range, depending on `mode`. Every react-day-picker prop
22
+ * passes through; this wraps it in the site's tokens and glyphs.
23
+ *
24
+ * Weeks start on Monday; pass `weekStartsOn` to change that.
25
+ */
26
+ export declare function Calendar({ className, classNames, fluid, ...props }: CalendarProps): import("react").JSX.Element;
27
+ export type { CalendarRange };