@seekalfred/primitives 0.6.0 → 0.7.1

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 (322) hide show
  1. package/README.md +19 -11
  2. package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
  3. package/dist/activity-heatmap/activity-heatmap.js +699 -0
  4. package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
  5. package/dist/activity-heatmap/index.d.ts +2 -0
  6. package/dist/activity-heatmap/index.js +2 -0
  7. package/dist/alert/alert.d.ts +5 -1
  8. package/dist/alert/alert.js +68 -7
  9. package/dist/alert/alert.js.map +1 -1
  10. package/dist/alert-dialog/alert-dialog.d.ts +45 -18
  11. package/dist/alert-dialog/alert-dialog.js +128 -9
  12. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  13. package/dist/alert-dialog/index.d.ts +2 -2
  14. package/dist/alert-dialog/index.js +2 -2
  15. package/dist/animated-counter/animated-counter.d.ts +38 -0
  16. package/dist/animated-counter/animated-counter.js +230 -0
  17. package/dist/animated-counter/animated-counter.js.map +1 -0
  18. package/dist/animated-counter/index.d.ts +2 -0
  19. package/dist/animated-counter/index.js +2 -0
  20. package/dist/announcement-bar/announcement-bar.d.ts +67 -0
  21. package/dist/announcement-bar/announcement-bar.js +364 -0
  22. package/dist/announcement-bar/announcement-bar.js.map +1 -0
  23. package/dist/announcement-bar/index.d.ts +2 -0
  24. package/dist/announcement-bar/index.js +2 -0
  25. package/dist/badge/badge.d.ts +1 -1
  26. package/dist/bar-chart/bar-chart.d.ts +51 -0
  27. package/dist/bar-chart/bar-chart.js +565 -0
  28. package/dist/bar-chart/bar-chart.js.map +1 -0
  29. package/dist/bar-chart/index.d.ts +2 -0
  30. package/dist/bar-chart/index.js +2 -0
  31. package/dist/breadcrumb/breadcrumb.d.ts +2 -2
  32. package/dist/breadcrumb/breadcrumb.js +12 -3
  33. package/dist/breadcrumb/breadcrumb.js.map +1 -1
  34. package/dist/brush-chart/brush-chart.d.ts +64 -0
  35. package/dist/brush-chart/brush-chart.js +1056 -0
  36. package/dist/brush-chart/brush-chart.js.map +1 -0
  37. package/dist/brush-chart/index.d.ts +2 -0
  38. package/dist/brush-chart/index.js +2 -0
  39. package/dist/button/button.d.ts +2 -2
  40. package/dist/button/button.js +31 -21
  41. package/dist/button/button.js.map +1 -1
  42. package/dist/button-group/button-group.js +3 -4
  43. package/dist/button-group/button-group.js.map +1 -1
  44. package/dist/card/card.js +1 -1
  45. package/dist/card/card.js.map +1 -1
  46. package/dist/card-stack/card-stack.d.ts +54 -0
  47. package/dist/card-stack/card-stack.js +492 -0
  48. package/dist/card-stack/card-stack.js.map +1 -0
  49. package/dist/card-stack/index.d.ts +2 -0
  50. package/dist/card-stack/index.js +2 -0
  51. package/dist/carousel/carousel.d.ts +56 -0
  52. package/dist/carousel/carousel.js +389 -0
  53. package/dist/carousel/carousel.js.map +1 -0
  54. package/dist/carousel/index.d.ts +2 -0
  55. package/dist/carousel/index.js +2 -0
  56. package/dist/checkbox/checkbox.js +4 -4
  57. package/dist/checkbox/checkbox.js.map +1 -1
  58. package/dist/chip-group/chip-group.d.ts +37 -0
  59. package/dist/chip-group/chip-group.js +148 -0
  60. package/dist/chip-group/chip-group.js.map +1 -0
  61. package/dist/chip-group/index.d.ts +2 -0
  62. package/dist/chip-group/index.js +2 -0
  63. package/dist/countdown/countdown.d.ts +45 -0
  64. package/dist/countdown/countdown.js +298 -0
  65. package/dist/countdown/countdown.js.map +1 -0
  66. package/dist/countdown/index.d.ts +2 -0
  67. package/dist/countdown/index.js +2 -0
  68. package/dist/date-picker/picker-parts.js +1 -1
  69. package/dist/date-picker/picker-parts.js.map +1 -1
  70. package/dist/dialog/dialog.js +1 -1
  71. package/dist/dialog/dialog.js.map +1 -1
  72. package/dist/donut-chart/donut-chart.d.ts +64 -0
  73. package/dist/donut-chart/donut-chart.js +576 -0
  74. package/dist/donut-chart/donut-chart.js.map +1 -0
  75. package/dist/donut-chart/index.d.ts +2 -0
  76. package/dist/donut-chart/index.js +2 -0
  77. package/dist/empty-state/empty-state.d.ts +21 -10
  78. package/dist/empty-state/empty-state.js +32 -26
  79. package/dist/empty-state/empty-state.js.map +1 -1
  80. package/dist/empty-state/index.d.ts +2 -2
  81. package/dist/empty-state/index.js +2 -2
  82. package/dist/file-drop-zone/file-drop-zone.js +1 -1
  83. package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
  84. package/dist/filter-bar/filter-bar.d.ts +47 -26
  85. package/dist/filter-bar/filter-bar.js +272 -156
  86. package/dist/filter-bar/filter-bar.js.map +1 -1
  87. package/dist/gauge/gauge.d.ts +45 -0
  88. package/dist/gauge/gauge.js +219 -0
  89. package/dist/gauge/gauge.js.map +1 -0
  90. package/dist/gauge/index.d.ts +2 -0
  91. package/dist/gauge/index.js +2 -0
  92. package/dist/in-view-title/in-view-title.d.ts +33 -0
  93. package/dist/in-view-title/in-view-title.js +119 -0
  94. package/dist/in-view-title/in-view-title.js.map +1 -0
  95. package/dist/in-view-title/index.d.ts +2 -0
  96. package/dist/in-view-title/index.js +2 -0
  97. package/dist/index.d.ts +49 -6
  98. package/dist/index.js +48 -8
  99. package/dist/lib/cn.js +11 -1
  100. package/dist/lib/cn.js.map +1 -1
  101. package/dist/lib/field-message.js +28 -10
  102. package/dist/lib/field-message.js.map +1 -1
  103. package/dist/lib/field-surface.js +9 -8
  104. package/dist/lib/field-surface.js.map +1 -1
  105. package/dist/lib/flag-emoji.js +50 -0
  106. package/dist/lib/flag-emoji.js.map +1 -0
  107. package/dist/lib/flip.js +11 -3
  108. package/dist/lib/flip.js.map +1 -1
  109. package/dist/lib/menu-highlight.js +64 -0
  110. package/dist/lib/menu-highlight.js.map +1 -0
  111. package/dist/lib/motion.js +9 -2
  112. package/dist/lib/motion.js.map +1 -1
  113. package/dist/lib/rolling-value.js +1 -1
  114. package/dist/lib/rolling-value.js.map +1 -1
  115. package/dist/lib/spring-tween.js +500 -0
  116. package/dist/lib/spring-tween.js.map +1 -0
  117. package/dist/lib/swap-text.js +3 -1
  118. package/dist/lib/swap-text.js.map +1 -1
  119. package/dist/line-chart/index.d.ts +2 -0
  120. package/dist/line-chart/index.js +2 -0
  121. package/dist/line-chart/line-chart.d.ts +76 -0
  122. package/dist/line-chart/line-chart.js +611 -0
  123. package/dist/line-chart/line-chart.js.map +1 -0
  124. package/dist/mention-input/index.d.ts +2 -0
  125. package/dist/mention-input/index.js +2 -0
  126. package/dist/mention-input/mention-input.d.ts +98 -0
  127. package/dist/mention-input/mention-input.js +576 -0
  128. package/dist/mention-input/mention-input.js.map +1 -0
  129. package/dist/menu/menu.d.ts +2 -0
  130. package/dist/menu/menu.js +23 -12
  131. package/dist/menu/menu.js.map +1 -1
  132. package/dist/money-input/index.d.ts +2 -0
  133. package/dist/money-input/index.js +2 -0
  134. package/dist/money-input/money-input.d.ts +65 -0
  135. package/dist/money-input/money-input.js +607 -0
  136. package/dist/money-input/money-input.js.map +1 -0
  137. package/dist/morph-select/index.d.ts +2 -0
  138. package/dist/morph-select/index.js +2 -0
  139. package/dist/morph-select/morph-select.d.ts +71 -0
  140. package/dist/morph-select/morph-select.js +693 -0
  141. package/dist/morph-select/morph-select.js.map +1 -0
  142. package/dist/multi-select/index.d.ts +2 -0
  143. package/dist/multi-select/index.js +2 -0
  144. package/dist/multi-select/multi-select.d.ts +36 -0
  145. package/dist/multi-select/multi-select.js +152 -0
  146. package/dist/multi-select/multi-select.js.map +1 -0
  147. package/dist/number-field/index.d.ts +2 -0
  148. package/dist/number-field/index.js +2 -0
  149. package/dist/number-field/number-field.d.ts +42 -0
  150. package/dist/number-field/number-field.js +199 -0
  151. package/dist/number-field/number-field.js.map +1 -0
  152. package/dist/onboarding-checklist/index.d.ts +2 -0
  153. package/dist/onboarding-checklist/index.js +2 -0
  154. package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
  155. package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
  156. package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
  157. package/dist/password-field/password-field.js +2 -2
  158. package/dist/password-field/password-field.js.map +1 -1
  159. package/dist/phone-input/index.d.ts +3 -0
  160. package/dist/phone-input/index.js +3 -0
  161. package/dist/phone-input/phone-countries.d.ts +29 -0
  162. package/dist/phone-input/phone-countries.js +170 -0
  163. package/dist/phone-input/phone-countries.js.map +1 -0
  164. package/dist/phone-input/phone-input.d.ts +66 -0
  165. package/dist/phone-input/phone-input.js +440 -0
  166. package/dist/phone-input/phone-input.js.map +1 -0
  167. package/dist/popover/popover.d.ts +12 -0
  168. package/dist/popover/popover.js +31 -7
  169. package/dist/popover/popover.js.map +1 -1
  170. package/dist/progress/progress.js +1 -1
  171. package/dist/radio-group/radio-group.js +1 -1
  172. package/dist/radio-group/radio-group.js.map +1 -1
  173. package/dist/reactions/index.d.ts +2 -0
  174. package/dist/reactions/index.js +2 -0
  175. package/dist/reactions/reactions.d.ts +50 -0
  176. package/dist/reactions/reactions.js +315 -0
  177. package/dist/reactions/reactions.js.map +1 -0
  178. package/dist/rich-text-editor/index.d.ts +3 -0
  179. package/dist/rich-text-editor/index.js +2 -0
  180. package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
  181. package/dist/rich-text-editor/rich-text-editor.js +909 -0
  182. package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
  183. package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
  184. package/dist/rich-text-editor/rich-text-engine.js +366 -0
  185. package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
  186. package/dist/rich-text-editor/rich-text-html.js +174 -0
  187. package/dist/rich-text-editor/rich-text-html.js.map +1 -0
  188. package/dist/rich-text-editor/rich-text-icons.js +43 -0
  189. package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
  190. package/dist/ridgeline/index.d.ts +2 -0
  191. package/dist/ridgeline/index.js +2 -0
  192. package/dist/ridgeline/ridgeline.d.ts +55 -0
  193. package/dist/ridgeline/ridgeline.js +701 -0
  194. package/dist/ridgeline/ridgeline.js.map +1 -0
  195. package/dist/scroll-area/index.d.ts +2 -2
  196. package/dist/scroll-area/index.js +2 -2
  197. package/dist/scroll-area/scroll-area.d.ts +68 -31
  198. package/dist/scroll-area/scroll-area.js +208 -59
  199. package/dist/scroll-area/scroll-area.js.map +1 -1
  200. package/dist/scrub-input/evaluate.d.ts +14 -0
  201. package/dist/scrub-input/evaluate.js +72 -0
  202. package/dist/scrub-input/evaluate.js.map +1 -0
  203. package/dist/scrub-input/index.d.ts +3 -0
  204. package/dist/scrub-input/index.js +3 -0
  205. package/dist/scrub-input/scrub-input.d.ts +74 -0
  206. package/dist/scrub-input/scrub-input.js +486 -0
  207. package/dist/scrub-input/scrub-input.js.map +1 -0
  208. package/dist/search-field/search-field.d.ts +2 -1
  209. package/dist/search-field/search-field.js +4 -4
  210. package/dist/search-field/search-field.js.map +1 -1
  211. package/dist/select/select.d.ts +3 -1
  212. package/dist/select/select.js +20 -8
  213. package/dist/select/select.js.map +1 -1
  214. package/dist/separator/separator.d.ts +1 -1
  215. package/dist/sheet/sheet.js +2 -1
  216. package/dist/sheet/sheet.js.map +1 -1
  217. package/dist/shortcut-recorder/index.d.ts +3 -0
  218. package/dist/shortcut-recorder/index.js +3 -0
  219. package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
  220. package/dist/shortcut-recorder/shortcut-model.js +206 -0
  221. package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
  222. package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
  223. package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
  224. package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
  225. package/dist/slider/index.d.ts +2 -2
  226. package/dist/slider/slider.d.ts +46 -14
  227. package/dist/slider/slider.js +151 -67
  228. package/dist/slider/slider.js.map +1 -1
  229. package/dist/slope-chart/index.d.ts +2 -0
  230. package/dist/slope-chart/index.js +2 -0
  231. package/dist/slope-chart/slope-chart.d.ts +54 -0
  232. package/dist/slope-chart/slope-chart.js +568 -0
  233. package/dist/slope-chart/slope-chart.js.map +1 -0
  234. package/dist/sparkline/index.d.ts +2 -0
  235. package/dist/sparkline/index.js +2 -0
  236. package/dist/sparkline/sparkline.d.ts +46 -0
  237. package/dist/sparkline/sparkline.js +390 -0
  238. package/dist/sparkline/sparkline.js.map +1 -0
  239. package/dist/split-bar/index.d.ts +2 -0
  240. package/dist/split-bar/index.js +2 -0
  241. package/dist/split-bar/split-bar.d.ts +62 -0
  242. package/dist/split-bar/split-bar.js +513 -0
  243. package/dist/split-bar/split-bar.js.map +1 -0
  244. package/dist/split-button/split-button.d.ts +1 -1
  245. package/dist/split-button/split-button.js +12 -11
  246. package/dist/split-button/split-button.js.map +1 -1
  247. package/dist/stat-card/index.d.ts +2 -2
  248. package/dist/stat-card/index.js +2 -2
  249. package/dist/stat-card/stat-card.d.ts +24 -4
  250. package/dist/stat-card/stat-card.js +114 -17
  251. package/dist/stat-card/stat-card.js.map +1 -1
  252. package/dist/stepper/index.d.ts +2 -0
  253. package/dist/stepper/index.js +2 -0
  254. package/dist/stepper/stepper.d.ts +51 -0
  255. package/dist/stepper/stepper.js +215 -0
  256. package/dist/stepper/stepper.js.map +1 -0
  257. package/dist/streamgraph/index.d.ts +2 -0
  258. package/dist/streamgraph/index.js +2 -0
  259. package/dist/streamgraph/streamgraph.d.ts +70 -0
  260. package/dist/streamgraph/streamgraph.js +613 -0
  261. package/dist/streamgraph/streamgraph.js.map +1 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/swipe-actions/index.d.ts +2 -0
  264. package/dist/swipe-actions/index.js +2 -0
  265. package/dist/swipe-actions/swipe-actions.d.ts +67 -0
  266. package/dist/swipe-actions/swipe-actions.js +552 -0
  267. package/dist/swipe-actions/swipe-actions.js.map +1 -0
  268. package/dist/switch/switch.js +2 -2
  269. package/dist/switch/switch.js.map +1 -1
  270. package/dist/table/index.d.ts +2 -2
  271. package/dist/table/index.js +2 -2
  272. package/dist/table/table.d.ts +56 -4
  273. package/dist/table/table.js +340 -165
  274. package/dist/table/table.js.map +1 -1
  275. package/dist/tabs/tabs.js +2 -2
  276. package/dist/tabs/tabs.js.map +1 -1
  277. package/dist/tag-input/index.d.ts +2 -0
  278. package/dist/tag-input/index.js +2 -0
  279. package/dist/tag-input/tag-input.d.ts +40 -0
  280. package/dist/tag-input/tag-input.js +269 -0
  281. package/dist/tag-input/tag-input.js.map +1 -0
  282. package/dist/text-morph/index.d.ts +2 -0
  283. package/dist/text-morph/index.js +2 -0
  284. package/dist/text-morph/text-morph.d.ts +23 -0
  285. package/dist/text-morph/text-morph.js +21 -0
  286. package/dist/text-morph/text-morph.js.map +1 -0
  287. package/dist/text-reveal/index.d.ts +2 -0
  288. package/dist/text-reveal/index.js +2 -0
  289. package/dist/text-reveal/text-reveal.d.ts +27 -0
  290. package/dist/text-reveal/text-reveal.js +51 -0
  291. package/dist/text-reveal/text-reveal.js.map +1 -0
  292. package/dist/text-shimmer/index.d.ts +2 -0
  293. package/dist/text-shimmer/index.js +2 -0
  294. package/dist/text-shimmer/text-shimmer.d.ts +29 -0
  295. package/dist/text-shimmer/text-shimmer.js +29 -0
  296. package/dist/text-shimmer/text-shimmer.js.map +1 -0
  297. package/dist/time-picker/time-picker.js +2 -2
  298. package/dist/time-picker/time-picker.js.map +1 -1
  299. package/dist/toast/index.d.ts +2 -2
  300. package/dist/toast/index.js +2 -2
  301. package/dist/toast/toast.d.ts +6 -0
  302. package/dist/toast/toast.js +82 -40
  303. package/dist/toast/toast.js.map +1 -1
  304. package/dist/tooltip/tooltip.d.ts +9 -2
  305. package/dist/tooltip/tooltip.js +7 -7
  306. package/dist/tooltip/tooltip.js.map +1 -1
  307. package/dist/treemap/index.d.ts +2 -0
  308. package/dist/treemap/index.js +2 -0
  309. package/dist/treemap/treemap.d.ts +53 -0
  310. package/dist/treemap/treemap.js +699 -0
  311. package/dist/treemap/treemap.js.map +1 -0
  312. package/dist/usage-meter/index.d.ts +2 -0
  313. package/dist/usage-meter/index.js +2 -0
  314. package/dist/usage-meter/usage-meter.d.ts +50 -0
  315. package/dist/usage-meter/usage-meter.js +440 -0
  316. package/dist/usage-meter/usage-meter.js.map +1 -0
  317. package/dist/waffle-chart/index.d.ts +2 -0
  318. package/dist/waffle-chart/index.js +2 -0
  319. package/dist/waffle-chart/waffle-chart.d.ts +57 -0
  320. package/dist/waffle-chart/waffle-chart.js +426 -0
  321. package/dist/waffle-chart/waffle-chart.js.map +1 -0
  322. package/package.json +165 -3
@@ -1,11 +1,15 @@
1
1
  "use client";
2
2
  import { cn, cnAll } from "../lib/cn.js";
3
3
  import { Button as Button$1 } from "../button/button.js";
4
+ import { SwapText } from "../lib/swap-text.js";
5
+ import { useFlip } from "../lib/flip.js";
6
+ import { Checkbox as Checkbox$1 } from "../checkbox/checkbox.js";
4
7
  import { Select as Select$1, SelectItem } from "../select/select.js";
5
8
  import { cva } from "class-variance-authority";
6
9
  import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
7
10
  import { Cell, Column, Row, Table, TableBody, TableFooter, TableHeader } from "react-aria-components";
8
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
+ import { flushSync } from "react-dom";
9
13
  //#region src/table/table.tsx
10
14
  /**
11
15
  * Table, ported from the legacy shadcn table onto React Aria's Table.
@@ -80,7 +84,7 @@ const tableCardVariants = cva([
80
84
  "data-[overflow-end]:after:opacity-15"
81
85
  ], {
82
86
  variants: { frame: {
83
- card: "rounded-md border-(length:--border-width) border-separator bg-background",
87
+ card: "rounded-panel border-(length:--border-width) border-separator bg-surface",
84
88
  none: ""
85
89
  } },
86
90
  defaultVariants: { frame: "card" }
@@ -104,12 +108,16 @@ function renderValue(column, value, row) {
104
108
  /** Reserved id for the chevron column, so it cannot collide with a real one. */
105
109
  const CHEVRON_COLUMN_ID = "__table_row_action";
106
110
  const CHEVRON_CELL = "w-10 px-0 text-center";
111
+ /** Reserved id for the checkbox column of a selectable table. */
112
+ const SELECT_COLUMN_ID = "__table_row_select";
113
+ /** The checkbox column is as wide as its box needs, with the table's usual inset on its leading side. */
114
+ const SELECT_CELL = "w-11 px-0 ps-(--density-row-pad-x)";
107
115
  /** The horizontal scroll container. The table owns it; 5 of 6 consumers built one by hand. */
108
116
  const tableScrollVariants = cva(["w-full overflow-x-auto box-border"]);
109
117
  const tableVariants = cva([
110
118
  "w-full border-collapse box-border",
111
119
  "font-sans text-base leading-(--leading-normal)",
112
- "bg-background text-foreground"
120
+ "bg-surface text-foreground"
113
121
  ]);
114
122
  /**
115
123
  * The header is near-white, not a grey band.
@@ -135,8 +143,24 @@ const tablePaginationVariants = cva([
135
143
  "px-(--density-row-pad-x) py-(--density-row-pad-y)",
136
144
  "font-sans text-sm leading-(--leading-normal) text-muted-foreground"
137
145
  ]);
146
+ /**
147
+ * The bar under a selectable table: how many rows, or how many are selected,
148
+ * and the action that clears them. A sibling of the table, like the pagination.
149
+ */
150
+ const tableSelectionBarVariants = cva([
151
+ "flex min-h-11 items-center justify-between gap-(--density-control-gap) box-border",
152
+ "border-t-(length:--border-width) border-t-separator",
153
+ "ps-(--density-row-pad-x) pe-2 font-sans text-sm leading-(--leading-normal)",
154
+ "text-muted-foreground data-[active]:text-foreground",
155
+ "motion-safe:transition-colors motion-safe:duration-(--duration-standard) motion-safe:ease-settle"
156
+ ]);
157
+ /**
158
+ * What stands in for the rows when there are none: centred, muted, and tall
159
+ * enough to read as a state rather than as a squashed row.
160
+ */
161
+ const tableEmptyVariants = cva(["flex min-h-30 items-center justify-center px-(--density-row-pad-x) py-6", "box-border text-center text-sm text-muted-foreground wrap-anywhere"]);
138
162
  /** The footer band. Heavier than a row rule, because it closes the table. */
139
- const tableFooterVariants = cva(["bg-background font-semibold text-foreground", "border-t-(length:--border-width) border-t-border"]);
163
+ const tableFooterVariants = cva(["bg-surface font-semibold text-foreground", "border-t-(length:--border-width) border-t-border"]);
140
164
  /** Shared focus treatment. Authored once; both the column header and the row take it. */
141
165
  const FOCUS_RING = [
142
166
  "outline-none",
@@ -148,6 +172,7 @@ const FOCUS_RING = [
148
172
  const tableColumnVariants = cva([
149
173
  "px-(--density-row-pad-x) py-(--density-row-pad-y)",
150
174
  "box-border align-middle text-sm font-semibold select-none",
175
+ "data-[sorted]:bg-foreground/3 data-[sorted]:text-foreground",
151
176
  ...FOCUS_RING,
152
177
  "data-[allows-sorting]:cursor-pointer"
153
178
  ], {
@@ -168,9 +193,10 @@ const tableColumnVariants = cva([
168
193
  }
169
194
  });
170
195
  const tableRowVariants = cva([
171
- "group/row box-border",
196
+ "group/row box-border bg-surface",
172
197
  "motion-safe:transition-colors motion-safe:duration-(--duration-fast) motion-safe:ease-standard",
173
198
  "hover:bg-muted data-[hovered]:bg-muted data-[focused]:bg-muted",
199
+ "data-[selected]:bg-muted data-[selected]:hover:bg-separator data-[selected]:data-[hovered]:bg-separator",
174
200
  "data-[highlighted]:bg-primary-subtle",
175
201
  ...FOCUS_RING
176
202
  ], {
@@ -191,7 +217,8 @@ const tableRowVariants = cva([
191
217
  });
192
218
  const tableCellVariants = cva([
193
219
  "px-(--density-row-pad-x) py-(--density-row-pad-y)",
194
- "box-border align-middle",
220
+ "box-border align-middle wrap-anywhere",
221
+ "data-[sorted]:bg-foreground/3",
195
222
  ...FOCUS_RING
196
223
  ], {
197
224
  variants: {
@@ -201,7 +228,7 @@ const tableCellVariants = cva([
201
228
  end: "text-end"
202
229
  },
203
230
  numeric: {
204
- true: "tabular-nums",
231
+ true: "tabular-nums whitespace-nowrap",
205
232
  false: ""
206
233
  }
207
234
  },
@@ -223,9 +250,9 @@ const tableStickyCellVariants = cva(["sticky start-0 z-1", "border-e-(length:--b
223
250
  variants: {
224
251
  part: {
225
252
  header: "bg-header-fill",
226
- bare: "bg-background",
253
+ bare: "bg-surface",
227
254
  body: [
228
- "bg-background",
255
+ "bg-surface",
229
256
  "group-hover/row:bg-muted group-data-[hovered]/row:bg-muted group-data-[focused]/row:bg-muted",
230
257
  "group-data-[highlighted]/row:bg-primary-subtle"
231
258
  ]
@@ -349,7 +376,7 @@ function RowChevronGlyph() {
349
376
  });
350
377
  }
351
378
  function SortCaretGlyph({ direction }) {
352
- return /* @__PURE__ */ jsx("svg", {
379
+ return /* @__PURE__ */ jsxs("svg", {
353
380
  "data-slot": "table-sort-caret",
354
381
  "data-direction": direction,
355
382
  "aria-hidden": "true",
@@ -359,8 +386,67 @@ function SortCaretGlyph({ direction }) {
359
386
  strokeWidth: "1.5",
360
387
  strokeLinecap: "round",
361
388
  strokeLinejoin: "round",
362
- className: "size-(--icon-sm) ms-1 inline-block align-middle",
363
- children: direction === "none" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", { d: "m4 7 4-4 4 4" }), /* @__PURE__ */ jsx("path", { d: "m4 9 4 4 4-4" })] }) : /* @__PURE__ */ jsx("path", { d: direction === "ascending" ? "m4 10 4-4 4 4" : "m4 6 4 4 4-4" })
389
+ className: "table-sort-caret size-(--icon-sm) ms-1 inline-block align-middle",
390
+ children: [/* @__PURE__ */ jsxs("g", {
391
+ className: "table-sort-idle",
392
+ children: [/* @__PURE__ */ jsx("path", { d: "m4 7 4-4 4 4" }), /* @__PURE__ */ jsx("path", { d: "m4 9 4 4 4-4" })]
393
+ }), /* @__PURE__ */ jsxs("g", {
394
+ className: "table-sort-arrow",
395
+ children: [/* @__PURE__ */ jsx("path", { d: "M8 13V3" }), /* @__PURE__ */ jsx("path", { d: "m4.5 6.5 3.5-3.5 3.5 3.5" })]
396
+ })]
397
+ });
398
+ }
399
+ /** 1 when the value grew, -1 when it shrank: the way a changed number swaps. Updated during render. */
400
+ function useChangeDirection(value) {
401
+ const [seen, setSeen] = useState({
402
+ value,
403
+ dir: 1
404
+ });
405
+ if (seen.value !== value) setSeen({
406
+ value,
407
+ dir: value < seen.value ? -1 : 1
408
+ });
409
+ return seen.dir;
410
+ }
411
+ /**
412
+ * The bar under a selectable table. With nothing chosen it counts the rows
413
+ * ("12 rows"); with some chosen it counts them ("3 selected") and offers the
414
+ * way back. The number and the word swap in place as they change.
415
+ */
416
+ function SelectionBar({ count, total, labels, onClear }) {
417
+ const shown = count || total;
418
+ const noun = count ? labels.selected : shown === 1 ? labels.item.one : labels.item.other;
419
+ const direction = useChangeDirection(shown);
420
+ return /* @__PURE__ */ jsxs("div", {
421
+ "data-slot": "table-selection-bar",
422
+ "data-active": count > 0 || void 0,
423
+ className: cnAll(tableSelectionBarVariants()),
424
+ children: [/* @__PURE__ */ jsxs("span", {
425
+ "data-slot": "table-selection-count",
426
+ className: "inline-flex items-baseline gap-1",
427
+ children: [
428
+ /* @__PURE__ */ jsx(SwapText, {
429
+ swapKey: String(shown),
430
+ dir: direction,
431
+ className: "inline-block tabular-nums",
432
+ children: shown
433
+ }),
434
+ " ",
435
+ /* @__PURE__ */ jsx(SwapText, {
436
+ swapKey: noun,
437
+ dir: count ? 1 : -1,
438
+ className: "inline-block",
439
+ children: noun
440
+ })
441
+ ]
442
+ }), count > 0 ? /* @__PURE__ */ jsx(Button$1, {
443
+ variant: "ghost",
444
+ size: "sm",
445
+ "data-slot": "table-selection-clear",
446
+ className: "motion-safe:animate-fade-in",
447
+ onPress: onClear,
448
+ children: labels.clear
449
+ }) : null]
364
450
  });
365
451
  }
366
452
  /** Builds columns that keep each column's own value type. */
@@ -370,9 +456,11 @@ function createColumns() {
370
456
  /**
371
457
  * A data table.
372
458
  *
373
- * Maturity: **beta**. Selection, row expansion, filtering, grouping, the total
374
- * row and pagination are deliberately absent -- each had one consumer or none
375
- * across the six legacy tables, and the stateful ones belong to DataGrid.
459
+ * Maturity: **beta**. Row expansion, filtering and grouping are deliberately
460
+ * absent -- each had one consumer or none across the six legacy tables, and the
461
+ * stateful ones belong to DataGrid. Sorting glides: when a sort reorders the
462
+ * rows, each slides to its new place instead of jumping (the lib/flip helper).
463
+ * Selection is opt-in with `selectionMode="multiple"`.
376
464
  *
377
465
  * @example
378
466
  * const { column } = createColumns<Channel>();
@@ -408,7 +496,7 @@ function compareKeys(a, b) {
408
496
  if (typeof a === "number" && typeof b === "number") return a - b;
409
497
  return String(a).localeCompare(String(b));
410
498
  }
411
- const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant, sortDescriptor, defaultSortDescriptor, onSortChange, onRowAction, isRowHighlighted, rowClassName, frame, headerType, headerFill, striped, totalRow, empty, minWidth, stickyFirstColumn, pageSize, pageSizeOptions, onPageSizeChange, pageLabels, className, ...props }, ref) {
499
+ const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant, sortDescriptor, defaultSortDescriptor, onSortChange, onRowAction, isRowHighlighted, rowClassName, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, selectionLabels, frame, headerType, headerFill, striped, totalRow, empty, minWidth, stickyFirstColumn, pageSize, pageSizeOptions, onPageSizeChange, pageLabels, className, ...props }, ref) {
412
500
  const isControlled = sortDescriptor !== void 0;
413
501
  const [uncontrolledSort, setUncontrolledSort] = useState(defaultSortDescriptor);
414
502
  const activeSort = isControlled ? sortDescriptor : uncontrolledSort;
@@ -439,12 +527,49 @@ const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant,
439
527
  rowsPerPage: pageLabels?.rowsPerPage ?? "Rows per page"
440
528
  };
441
529
  const rowsByKey = new Map(data.map((row) => [getRowId(row), row]));
530
+ const selectable = selectionMode === "multiple";
531
+ const [uncontrolledSelection, setUncontrolledSelection] = useState(defaultSelectedKeys ?? /* @__PURE__ */ new Set());
532
+ const selection = selectedKeys ?? uncontrolledSelection;
533
+ const commitSelection = (keys) => {
534
+ if (selectedKeys === void 0) setUncontrolledSelection(keys);
535
+ onSelectionChange?.(keys);
536
+ };
537
+ const selectedCount = selection === "all" ? visibleRows.length : [...selection].filter((key) => rowsByKey.has(key)).length;
538
+ const selectLabels = {
539
+ item: selectionLabels?.item ?? {
540
+ one: "row",
541
+ other: "rows"
542
+ },
543
+ selected: selectionLabels?.selected ?? "selected",
544
+ clear: selectionLabels?.clear ?? "Clear selection"
545
+ };
546
+ const sortedColumn = activeSort?.column;
442
547
  const hasWidths = columns.some((column) => column.width !== void 0);
443
548
  const tableStyle = {};
444
549
  if (minWidth !== void 0) tableStyle.minWidth = minWidth;
445
550
  if (hasWidths) tableStyle.tableLayout = "fixed";
446
551
  const scrollRef = useRef(null);
447
552
  const edges = useScrollEdges(scrollRef);
553
+ const [rowOrder, setRowOrder] = useState("");
554
+ useEffect(() => {
555
+ const root = scrollRef.current;
556
+ if (!root) return;
557
+ let last = "";
558
+ const look = () => {
559
+ const next = Array.from(root.querySelectorAll("tbody > [data-flip]")).map((row) => row.dataset.flip).join("\0");
560
+ if (next === last) return;
561
+ last = next;
562
+ flushSync(() => setRowOrder(next));
563
+ };
564
+ look();
565
+ const observer = new MutationObserver(look);
566
+ observer.observe(root, {
567
+ childList: true,
568
+ subtree: true
569
+ });
570
+ return () => observer.disconnect();
571
+ }, []);
572
+ useFlip(scrollRef, rowOrder, "var(--duration-smooth)", "var(--ease-smooth)", true);
448
573
  const stickyCell = (part) => tableStickyCellVariants({
449
574
  part,
450
575
  striped: part === "body" && !!striped
@@ -455,161 +580,211 @@ const Table$1 = forwardRef(function Table$2({ data, columns, getRowId, variant,
455
580
  "data-overflow-end": edges.end || void 0,
456
581
  "data-sticky-first": stickyFirstColumn || void 0,
457
582
  className: cnAll(tableCardVariants({ frame })),
458
- children: [/* @__PURE__ */ jsx("div", {
459
- ref: scrollRef,
460
- "data-slot": "table-scroll",
461
- className: cnAll(tableScrollVariants()),
462
- children: /* @__PURE__ */ jsxs(Table, {
463
- ref,
464
- ...props,
465
- "data-slot": "table",
466
- className: cn(tableVariants(), className),
467
- style: tableStyle,
468
- sortDescriptor: activeSort,
469
- onSortChange: (descriptor) => {
470
- if (!isControlled) setUncontrolledSort(descriptor);
471
- setPage(1);
472
- onSortChange?.(descriptor);
473
- },
474
- onRowAction: onRowAction ? (key) => {
475
- const row = rowsByKey.get(key);
476
- if (row !== void 0) onRowAction(row);
477
- } : void 0,
478
- children: [
479
- /* @__PURE__ */ jsxs(TableHeader, {
480
- "data-slot": "table-header",
481
- className: cnAll(tableHeaderVariants({ headerFill })),
482
- children: [columns.map((column) => /* @__PURE__ */ jsxs(Column, {
483
- id: column.id,
484
- isRowHeader: column === columns[0],
485
- allowsSorting: column.sortable,
486
- "data-slot": "table-column",
487
- className: cnAll(tableColumnVariants({
488
- align: column.align ?? (column.numeric ? "end" : void 0),
489
- headerType
490
- }), stickyFirstColumn && column === columns[0] && stickyCell(headerFill === "none" ? "bare" : "header")),
491
- style: column.width === void 0 ? void 0 : { width: column.width },
492
- children: [column.header, column.sortable ? /* @__PURE__ */ jsx(SortCaretGlyph, { direction: activeSort?.column === column.id ? activeSort.direction : "none" }) : null]
493
- }, column.id)), onRowAction ? /* @__PURE__ */ jsx(Column, {
494
- id: CHEVRON_COLUMN_ID,
495
- "data-slot": "table-column",
496
- className: cnAll(tableColumnVariants({ headerType }), CHEVRON_CELL),
497
- children: ""
498
- }) : null]
499
- }),
500
- /* @__PURE__ */ jsx(TableBody, {
501
- "data-slot": "table-body",
502
- renderEmptyState: empty === void 0 ? void 0 : () => empty,
503
- children: visibleRows.map((row, index) => /* @__PURE__ */ jsxs(Row, {
504
- id: getRowId(row),
505
- "data-slot": "table-row",
506
- "data-highlighted": isRowHighlighted?.(row) || void 0,
507
- className: cn(cnAll(tableRowVariants({
508
- variant,
509
- striped
510
- }), onRowAction && "cursor-pointer"), rowClassName?.(row)),
511
- children: [columns.map((column) => {
512
- const value = column.accessor(row);
513
- return /* @__PURE__ */ jsx(Cell, {
514
- "data-slot": "table-cell",
515
- className: cnAll(tableCellVariants({
583
+ children: [
584
+ /* @__PURE__ */ jsx("div", {
585
+ ref: scrollRef,
586
+ "data-slot": "table-scroll",
587
+ className: cnAll(tableScrollVariants()),
588
+ children: /* @__PURE__ */ jsxs(Table, {
589
+ ref,
590
+ ...props,
591
+ "data-slot": "table",
592
+ className: cn(tableVariants(), className),
593
+ style: tableStyle,
594
+ selectionMode: selectable ? "multiple" : void 0,
595
+ selectedKeys: selectable ? selection : void 0,
596
+ onSelectionChange: selectable ? commitSelection : void 0,
597
+ sortDescriptor: activeSort,
598
+ onSortChange: (descriptor) => {
599
+ if (!isControlled) setUncontrolledSort(descriptor);
600
+ setPage(1);
601
+ onSortChange?.(descriptor);
602
+ },
603
+ onRowAction: onRowAction ? (key) => {
604
+ const row = rowsByKey.get(key);
605
+ if (row !== void 0) onRowAction(row);
606
+ } : void 0,
607
+ children: [
608
+ /* @__PURE__ */ jsxs(TableHeader, {
609
+ "data-slot": "table-header",
610
+ className: cnAll(tableHeaderVariants({ headerFill })),
611
+ children: [
612
+ selectable ? /* @__PURE__ */ jsx(Column, {
613
+ id: SELECT_COLUMN_ID,
614
+ "data-slot": "table-column",
615
+ className: cnAll(tableColumnVariants({ headerType }), SELECT_CELL, stickyFirstColumn && stickyCell(headerFill === "none" ? "bare" : "header"), stickyFirstColumn && "border-e-0"),
616
+ children: /* @__PURE__ */ jsx(Checkbox$1, {
617
+ slot: "selection",
618
+ "aria-label": selectionLabels?.selectAll
619
+ })
620
+ }) : null,
621
+ columns.map((column) => /* @__PURE__ */ jsxs(Column, {
622
+ id: column.id,
623
+ isRowHeader: column === columns[0],
624
+ allowsSorting: column.sortable,
625
+ "data-slot": "table-column",
626
+ "data-sorted": sortedColumn === column.id || void 0,
627
+ className: cnAll(tableColumnVariants({
516
628
  align: column.align ?? (column.numeric ? "end" : void 0),
517
- numeric: column.numeric
518
- }), stickyFirstColumn && column === columns[0] && stickyCell("body")),
519
- children: column.cell ? column.cell({
520
- value,
521
- row,
522
- index
523
- }) : renderValue(column, value, row)
524
- }, column.id);
525
- }), onRowAction ? /* @__PURE__ */ jsx(Cell, {
526
- "data-slot": "table-cell",
527
- className: cnAll(tableCellVariants(), CHEVRON_CELL),
528
- children: /* @__PURE__ */ jsx(RowChevronGlyph, {})
529
- }) : null]
530
- }, String(getRowId(row))))
531
- }),
532
- totalRow ? /* @__PURE__ */ jsx(TableFooter, {
533
- "data-slot": "table-footer",
534
- className: cnAll(tableFooterVariants()),
535
- children: /* @__PURE__ */ jsxs(Row, {
536
- id: "__table_total",
537
- children: [columns.map((col) => /* @__PURE__ */ jsx(Cell, {
538
- "data-slot": "table-cell",
539
- className: cnAll(tableCellVariants({
540
- align: col.align ?? (col.numeric ? "end" : void 0),
541
- numeric: col.numeric
542
- }), stickyFirstColumn && col === columns[0] && stickyCell("bare")),
543
- children: totalRow(col)
544
- }, col.id)), onRowAction ? /* @__PURE__ */ jsx(Cell, {
545
- "data-slot": "table-cell",
546
- className: cnAll(tableCellVariants(), CHEVRON_CELL),
547
- children: ""
548
- }) : null]
629
+ headerType
630
+ }), stickyFirstColumn && column === columns[0] && stickyCell(headerFill === "none" ? "bare" : "header"), stickyFirstColumn && selectable && column === columns[0] && "start-11"),
631
+ style: column.width === void 0 ? void 0 : { width: column.width },
632
+ children: [column.header, column.sortable ? /* @__PURE__ */ jsx(SortCaretGlyph, { direction: activeSort?.column === column.id ? activeSort.direction : "none" }) : null]
633
+ }, column.id)),
634
+ onRowAction ? /* @__PURE__ */ jsx(Column, {
635
+ id: CHEVRON_COLUMN_ID,
636
+ "data-slot": "table-column",
637
+ className: cnAll(tableColumnVariants({ headerType }), CHEVRON_CELL),
638
+ children: ""
639
+ }) : null
640
+ ]
641
+ }),
642
+ /* @__PURE__ */ jsx(TableBody, {
643
+ "data-slot": "table-body",
644
+ renderEmptyState: empty === void 0 ? void 0 : () => /* @__PURE__ */ jsx("div", {
645
+ "data-slot": "table-empty",
646
+ className: cnAll(tableEmptyVariants()),
647
+ children: empty
648
+ }),
649
+ children: visibleRows.map((row, index) => /* @__PURE__ */ jsxs(Row, {
650
+ id: getRowId(row),
651
+ "data-slot": "table-row",
652
+ "data-flip": String(getRowId(row)),
653
+ "data-highlighted": isRowHighlighted?.(row) || void 0,
654
+ className: cn(cnAll(tableRowVariants({
655
+ variant,
656
+ striped
657
+ }), onRowAction && "cursor-pointer"), rowClassName?.(row)),
658
+ children: [
659
+ selectable ? /* @__PURE__ */ jsx(Cell, {
660
+ "data-slot": "table-cell",
661
+ className: cnAll(tableCellVariants(), SELECT_CELL, stickyFirstColumn && stickyCell("body"), stickyFirstColumn && "border-e-0"),
662
+ children: /* @__PURE__ */ jsx(Checkbox$1, {
663
+ slot: "selection",
664
+ "aria-label": selectionLabels?.selectRow
665
+ })
666
+ }) : null,
667
+ columns.map((column) => {
668
+ const value = column.accessor(row);
669
+ return /* @__PURE__ */ jsx(Cell, {
670
+ "data-slot": "table-cell",
671
+ "data-sorted": sortedColumn === column.id || void 0,
672
+ className: cnAll(tableCellVariants({
673
+ align: column.align ?? (column.numeric ? "end" : void 0),
674
+ numeric: column.numeric
675
+ }), stickyFirstColumn && column === columns[0] && stickyCell("body"), stickyFirstColumn && selectable && column === columns[0] && "start-11"),
676
+ children: column.cell ? column.cell({
677
+ value,
678
+ row,
679
+ index
680
+ }) : renderValue(column, value, row)
681
+ }, column.id);
682
+ }),
683
+ onRowAction ? /* @__PURE__ */ jsx(Cell, {
684
+ "data-slot": "table-cell",
685
+ className: cnAll(tableCellVariants(), CHEVRON_CELL),
686
+ children: /* @__PURE__ */ jsx(RowChevronGlyph, {})
687
+ }) : null
688
+ ]
689
+ }, String(getRowId(row))))
690
+ }),
691
+ totalRow ? /* @__PURE__ */ jsx(TableFooter, {
692
+ "data-slot": "table-footer",
693
+ className: cnAll(tableFooterVariants()),
694
+ children: /* @__PURE__ */ jsxs(Row, {
695
+ id: "__table_total",
696
+ children: [
697
+ selectable ? /* @__PURE__ */ jsx(Cell, {
698
+ "data-slot": "table-cell",
699
+ className: cnAll(tableCellVariants(), SELECT_CELL, stickyFirstColumn && stickyCell("bare"), stickyFirstColumn && "border-e-0"),
700
+ children: ""
701
+ }) : null,
702
+ columns.map((col) => /* @__PURE__ */ jsx(Cell, {
703
+ "data-slot": "table-cell",
704
+ className: cnAll(tableCellVariants({
705
+ align: col.align ?? (col.numeric ? "end" : void 0),
706
+ numeric: col.numeric
707
+ }), stickyFirstColumn && col === columns[0] && stickyCell("bare"), stickyFirstColumn && selectable && col === columns[0] && "start-11"),
708
+ children: totalRow(col)
709
+ }, col.id)),
710
+ onRowAction ? /* @__PURE__ */ jsx(Cell, {
711
+ "data-slot": "table-cell",
712
+ className: cnAll(tableCellVariants(), CHEVRON_CELL),
713
+ children: ""
714
+ }) : null
715
+ ]
716
+ })
717
+ }) : null
718
+ ]
719
+ })
720
+ }),
721
+ selectable ? /* @__PURE__ */ jsx(SelectionBar, {
722
+ count: selectedCount,
723
+ total: data.length,
724
+ labels: selectLabels,
725
+ onClear: () => commitSelection(/* @__PURE__ */ new Set())
726
+ }) : null,
727
+ rowsPerPage === void 0 || pageCount <= 1 && !pageSizeOptions ? null : /* @__PURE__ */ jsxs("nav", {
728
+ "data-slot": "table-pagination",
729
+ "aria-label": `${props["aria-label"]} pagination`,
730
+ className: cnAll(tablePaginationVariants()),
731
+ children: [/* @__PURE__ */ jsx("div", {
732
+ "data-slot": "table-pagination-pages",
733
+ className: "flex items-center gap-1",
734
+ children: pageCount <= 1 ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [
735
+ /* @__PURE__ */ jsx(Button$1, {
736
+ variant: "ghost",
737
+ size: "sm",
738
+ className: "w-(--density-control-h-sm) px-0",
739
+ "aria-label": labels.previous,
740
+ isDisabled: currentPage <= 1,
741
+ onPress: () => setPage(currentPage - 1),
742
+ children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "previous" })
743
+ }),
744
+ pageWindow(currentPage, pageCount).map((entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx("span", {
745
+ "data-slot": "table-pagination-ellipsis",
746
+ "aria-hidden": "true",
747
+ className: "px-2 text-sm text-muted-foreground",
748
+ children: "…"
749
+ }, `ellipsis-${String(index)}`) : /* @__PURE__ */ jsx(Button$1, {
750
+ variant: entry === currentPage ? "primary" : "ghost",
751
+ size: "sm",
752
+ className: "min-w-(--density-control-h-sm) px-2",
753
+ "aria-label": labels.page(entry, entry === currentPage),
754
+ onPress: () => setPage(entry),
755
+ children: entry
756
+ }, entry)),
757
+ /* @__PURE__ */ jsx(Button$1, {
758
+ variant: "ghost",
759
+ size: "sm",
760
+ className: "w-(--density-control-h-sm) px-0",
761
+ "aria-label": labels.next,
762
+ isDisabled: currentPage >= pageCount,
763
+ onPress: () => setPage(currentPage + 1),
764
+ children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "next" })
549
765
  })
550
- }) : null
551
- ]
766
+ ] })
767
+ }), pageSizeOptions === void 0 ? null : /* @__PURE__ */ jsx(Select$1, {
768
+ className: "w-auto",
769
+ label: labels.rowsPerPage,
770
+ labelHidden: true,
771
+ selectedKey: String(rowsPerPage),
772
+ onSelectionChange: (key) => {
773
+ const size = Number(key);
774
+ setChosenSize(size);
775
+ setPage(1);
776
+ onPageSizeChange?.(size);
777
+ },
778
+ children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, {
779
+ id: String(option),
780
+ children: labels.perPage(option)
781
+ }, option))
782
+ })]
552
783
  })
553
- }), rowsPerPage === void 0 || pageCount <= 1 && !pageSizeOptions ? null : /* @__PURE__ */ jsxs("nav", {
554
- "data-slot": "table-pagination",
555
- "aria-label": `${props["aria-label"]} pagination`,
556
- className: cnAll(tablePaginationVariants()),
557
- children: [/* @__PURE__ */ jsx("div", {
558
- "data-slot": "table-pagination-pages",
559
- className: "flex items-center gap-1",
560
- children: pageCount <= 1 ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [
561
- /* @__PURE__ */ jsx(Button$1, {
562
- variant: "ghost",
563
- size: "sm",
564
- className: "w-(--density-control-h-sm) px-0",
565
- "aria-label": labels.previous,
566
- isDisabled: currentPage <= 1,
567
- onPress: () => setPage(currentPage - 1),
568
- children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "previous" })
569
- }),
570
- pageWindow(currentPage, pageCount).map((entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx("span", {
571
- "data-slot": "table-pagination-ellipsis",
572
- "aria-hidden": "true",
573
- className: "px-2 text-sm text-muted-foreground",
574
- children: "…"
575
- }, `ellipsis-${String(index)}`) : /* @__PURE__ */ jsx(Button$1, {
576
- variant: entry === currentPage ? "primary" : "ghost",
577
- size: "sm",
578
- className: "min-w-(--density-control-h-sm) px-2",
579
- "aria-label": labels.page(entry, entry === currentPage),
580
- onPress: () => setPage(entry),
581
- children: entry
582
- }, entry)),
583
- /* @__PURE__ */ jsx(Button$1, {
584
- variant: "ghost",
585
- size: "sm",
586
- className: "w-(--density-control-h-sm) px-0",
587
- "aria-label": labels.next,
588
- isDisabled: currentPage >= pageCount,
589
- onPress: () => setPage(currentPage + 1),
590
- children: /* @__PURE__ */ jsx(PageChevronGlyph, { direction: "next" })
591
- })
592
- ] })
593
- }), pageSizeOptions === void 0 ? null : /* @__PURE__ */ jsx(Select$1, {
594
- className: "w-auto",
595
- label: labels.rowsPerPage,
596
- labelHidden: true,
597
- selectedKey: String(rowsPerPage),
598
- onSelectionChange: (key) => {
599
- const size = Number(key);
600
- setChosenSize(size);
601
- setPage(1);
602
- onPageSizeChange?.(size);
603
- },
604
- children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, {
605
- id: String(option),
606
- children: labels.perPage(option)
607
- }, option))
608
- })]
609
- })]
784
+ ]
610
785
  });
611
786
  });
612
787
  //#endregion
613
- export { Table$1 as Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableStickyCellVariants, tableVariants };
788
+ export { Table$1 as Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants };
614
789
 
615
790
  //# sourceMappingURL=table.js.map